Python Forum
[PyQt] Invoking user interface design
Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] Invoking user interface design
#1
Hey everyone, I am currently teaching myself to use PyQt4 and I have one problem that I do not know how to fix.

When I design my interface in PyQt4 and convert it to py and import it into my Python script nothing seems to happen. 

I got the code from a textbook, Please see code below:



import sys
from fairCalculator import *
from PyQt4.QtGui import *

class MyForm(QtGui.QDialog):
    def ___init___(self, parent = None):
        QtGui.QWidget.___init___(self, parent)
        self.ui = Ui_Dialog()
        self.ui.setupUi(self)
        timer = QtCore.QTimer(self)
        timer.timeout.connect(self.showlcd)
        timer.start(1000)
        self.showlcd()
        
        QtGui.QObject.connect(self.ui.buttonOne, QtCore.SIGNAL('clicked()'), self.buttonOne)

    def buttonOne(self):
        self.ui.label.setText("Please pay R 10.00 for Class One.")

    def showlcd(self):
        time = QtCore.QTime.currentTime()
        text = time.toString('hh:mm')
        self.ui.lcdNumber.display(text)

if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv)
    myapp = MyForm()
    myapp.show()
    sys.exit(app.exec_())
When I press F5 to run the program I do not get any errors but the interface do not show. A window named Pythonw but nothing appears on the screen it's just a blank window. Now I have tried to re-install the programs I even tried different versions, I even went so far to test it on three different computers and the result is the same.

Any assistance will be appreciated

I am using Python version 3.4 and PyQt4 version 4.11.4
Reply
#2
you are suposed to put the code in the code box, not around it
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] User interface for stock portfolio optimisation Fourchelangue 2 2,633 Apr-04-2020, 01:11 PM
Last Post: Fourchelangue
  [Tkinter] User interface for stock portfolio optimisation Fourchelangue 0 1,997 Apr-02-2020, 10:10 PM
Last Post: Fourchelangue
  [PyQt] User Interface to Python Raures 11 10,608 Jan-24-2017, 05:01 AM
Last Post: California

Forum Jump:

User Panel Messages

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