If you want to use Python to develop a graphical interface, there are many tools to choose from, each with the pros and cons, previously used Wxpython+boa-constructor, has not been clear.
New understanding of the next PyQt4, seems to use this person also more, so decided to start learning this. Version:pyqt-py2.7-x86-gpl-4.9.1-1.exe
PyQt4 takes a QT designer and uses it to create an interface, layout controls such as Form,button,text, and so on, using the edit signal/slot pattern to define events.
Similar to C # creation form, but not as convenient as C #.
General steps:
1. Create GUI interface with designer, select template after startup, such as widget, drag some controls to interface, such as Button,text
2. Modify the control's name, text, title, and so on by the right property editor
3. Save as a. ui file, through the Pyuic4.bat tool under PYQT4, command line execution: Pyuic4.bat test.ui > ui_test.py generates a UI class file for the UI interface design
4. Then write the custom class and Main, and use the UI classes file import
5. Expand functionality by setting up your own slots (not yet researched)
PS:QT uses a mechanism called signal/slot (signals/slots) to pass events and messages between window artifacts (and other objects).
================================================================
# Simple Notepad, open (empty), close
Import Sys
From PYQT4 import Qtgui
From Ui_notepad import Ui_notepad
Class Mynotepad (Qtgui.qmainwindow):
'''
Classdocs
'''
def __init__ (Self,parent=none):
'''
Constructor
'''
qtgui.qwidget.__init__ (self,parent)
Self.ui = Ui_notepad ()
Self.ui.setupUi (self)
if __name__ = = ' __main__ ':
App = Qtgui.qapplication (SYS.ARGV) # * must
MyApp = Mynotepad () # *
Myapp.show ()
Sys.exit (App.exec_ ()) # *