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.setupUi(self)
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()
form.show()
app.exec_()
Advertisements
Tagged ,

Leave a Reply

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

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: