PyQT – the first attempt

So here is the first working version of a PyQT GUI. It doesn’t do a vast amount at the moment – it initialises with some text in a textbox and then when the button is clicked it changes the text. I’ve learn’t how careful you need to be with syntax, how great Spyder is and also how useful StackOverflow is.

The code as shown in the image is:

from PyQt4.QtCore import *
from PyQt4.QtGui import *
import ui_FindPy
class FindPy(QDialog, ui_FindPy.Ui_Dialog):
def __init__(self, parent=None):
super(FindPy, self).__init__(parent)
self.connect(self.pushButton, SIGNAL("clicked()"), self.printFind) # nb: no () in SLOT call
def printFind(self):
self.textBrowser.setHtml("Bobby") # do something inane
if __name__ == "__main__":
import sys

 app = QApplication(sys.argv)

form = FindPy()

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

A Website.

Up ↑

%d bloggers like this: