October 27, 2016
Windows System Installation
1, Pyqt4 download installation
Pycharm on their own Baidu installed it.
PYQT4 installation package:
Https://www.riverbankcomputing.com/software/pyqt/download
My python is in the 2.7 version, and the pyqt4 here is pyqt4-4.11.4-gpl-py2.7-qt4.8.7-x32.
This bit is also very important, I started to choose 64-bit, when the. UI into a. py file when the error,
The error message is as follows
Import module times python importerror:dll load failed:%1 is not a valid WIN32 application
Workaround: Choose the 32-bit installation package, the 64-bit uninstall is good.
Click Install directly after download, the next step is good
2, Pycharm in the configuration PyQt4
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/89/62/wKiom1gRljbi83v_AAB6N5305WM648.png-wh_500x0-wm_3 -wmp_4-s_3862224249.png "title=" 1.png "alt=" Wkiom1grljbi83v_aab6n5305wm648.png-wh_50 "/>
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/89/60/wKioL1gRlmXgCKvKAADUMnDO-iM930.png-wh_500x0-wm_3 -wmp_4-s_202019057.png "title=" 1.png "alt=" Wkiol1grlmxgckvkaadumndo-im930.png-wh_50 "/>
C:\Python27\Lib\site-packages\PyQt4\designer.exe
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/89/62/wKiom1gRltfCgGBwAACsWjWYyq0600.png-wh_500x0-wm_3 -wmp_4-s_537825555.png "title=" 1.png "alt=" Wkiom1grltfcggbwaacswjwyyq0600.png-wh_50 "/>qi
C:\Python27\Lib\site-packages\PyQt4\uic\pyuic.py $FileName $-O $FileNameWithoutExtension $.py
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/89/60/wKioL1gRlwezPzInAACzP75mYfo322.png-wh_500x0-wm_3 -wmp_4-s_2072218592.png "title=" 1.png "alt=" Wkiol1grlwezpzinaaczp75myfo322.png-wh_50 "/>
Results after the completion
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/89/60/wKioL1gRl6TxCg9eAAGFOJVCh5k539.png-wh_500x0-wm_3 -wmp_4-s_2548653797.png "title=" 1.png "alt=" Wkiol1grl6txcg9eaagfojvch5k539.png-wh_50 "/>
Pyqt4 can be seen in Pycharm
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/89/60/wKioL1gRl-_h7zBRAACwnW3UhuA886.png-wh_500x0-wm_3 -wmp_4-s_3670502124.png "title=" 1.png "alt=" Wkiol1grl-_h7zbraacwnw3uhua886.png-wh_50 "/>
3, the use of PYQT design
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/89/60/wKioL1gRmIvBHhYbAAPrXBFUJAU522.png-wh_500x0-wm_3 -wmp_4-s_2724684214.png "title=" 1.png "alt=" Wkiol1grmivbhhybaaprxbfujau522.png-wh_50 "/>
Put the. UI Wencheng. Py method
Method 1, create a bat file, the content is as follows
@echo off
@cd/d "%~dp0"
Pyuic4%1 >%~n1.py
Method Two: The Windows CMD window
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/89/60/wKioL1gRmTaCyWAUAACriK4Rgps679.png-wh_500x0-wm_3 -wmp_4-s_1914761277.png "title=" 1.png "alt=" Wkiol1grmtacywauaacrik4rgps679.png-wh_50 "/>
Results after the completion
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/89/63/wKiom1gRmVmA5lo5AAEXjG0svSo067.png-wh_500x0-wm_3 -wmp_4-s_1174159364.png "title=" 1.png "alt=" Wkiom1grmvma5lo5aaexjg0svso067.png-wh_50 "/>
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/89/60/wKioL1gRmc2QAeVHAAENMidjh8A914.png-wh_500x0-wm_3 -wmp_4-s_222063825.png "title=" 1.png "alt=" Wkiol1grmc2qaevhaaenmidjh8a914.png-wh_50 "/>
Modify several places
Add Import sys
Modifies object in Ui_mainwidonw (object) to modify to Qtgui.qmainwindow
Under the Class class, add an init method:
def __init__ (self): Super (Ui_mainwindow,self). __init__ ()
Self.setupui (self)
Self.retranslateui (self)
Add the following code at the end of the code
App = Qtgui.qapplication (SYS.ARGV)
Win = Ui_mainwindow ()
Win.show ()
APP.EXEC_ ()
Execute, Interface successfully appeared
I add the following code, I do not use the above.
__name__ = =: App = qtgui.qapplication (sys.argv) MainWindow = Qtgui.qmainwindow () UI = Ui_mainwindow () ui.setupui ( MainWindow) Mainwindow.show () Sys.exit (App.exec_ ())
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/89/63/wKiom1gRmuCxYuq9AADwz30xYbo910.png-wh_500x0-wm_3 -wmp_4-s_3387570629.png "title=" 1.png "alt=" Wkiom1grmucxyuq9aadwz30xybo910.png-wh_50 "/>
Although ugly, but success is OK. Hey. It's just the environment.
For the following study, the installation of the Mac version is described later. Not on time yet.
Pycharm + pyqt4 Writing graphical user interface environment construction