Python Forum
Question regarding python pyqt script
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question regarding python pyqt script
#1
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
Reply
#2
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.
Reply
#3
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))".
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Star [PyQt] Python GUI - PyQt Containers and Layouts Explained panofish 0 910 Aug-28-2022, 07:29 PM
Last Post: panofish
  [PyQt] I build and install PyQT for python2 but it not recognize in python nadavvin 7 8,006 Mar-29-2019, 03:24 PM
Last Post: Axel_Erfurt
  [PyQt] Newbe question about Print() to PyQt TimW 9 14,359 Dec-19-2017, 11:36 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020