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_()
Leave a Reply