Python Forum
Question regarding python pyqt script - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: Question regarding python pyqt script (/thread-8253.html)



Question regarding python pyqt script - cibb - Feb-11-2018

I've built my GUi using qt and converted it and with some help I feel I'm close on the script portion to get my python script working with the GUI but I have some questions.

So this is a converter GUI. Someone will click a tab to select fluid conversion for example then a radio button for ML-OZ vs OZ-ML there is a qlineedit box to enter the value and a qlineedit for the output of the calculation and a button to initial the convertion.

My two questions:
1. is my loggic right with this.

If ML_OZ.isChecked():
Volume = float(get lineedit8)
Answer = (Volume / 29.5735296)
print


Question regarding python pyqt script - cibb - Feb-11-2018

I've built my GUi using qt and converted it and with some help I feel I'm close on the script portion to get my python script working with the GUI but I have some questions.

So this is a converter GUI. Someone will click a tab to select fluid conversion for example then a radio button for ML-OZ vs OZ-ML there is a qlineedit box to enter the value and a qlineedit for the output of the calculation and a button to initial the convertion.

My two questions:(Note:my code isn't complete I just want to make sure I'm on the right track with this first.)
1. is my loggic right with this.

def on_click(self.pushButton_5):
    If ML_OZ.isChecked():
        Volume = float(get lineedit8)
        Answer = (Volume / 29.5735296)
        print
    elif OZ_ML.isChecked():
2. Do I print "answer" to the qlineedit box or do I settext?

Hope this makes sense.


RE: Question regarding python pyqt script - Raures - Feb-18-2018

1. Will not work, because "Volume = float(get lineedit8)" will throw an error, also, why not just try "Answer = (int(lineedit8.text()) / 29.5735286)"?
2. "print" is a function for python console, not for PyQt, so you have to "lineedit8.setText(str(Answer))".