Using QtDesigner with PyQt4.
- -
How to use QtDesigner is outside the scope of this screen cast. There are many others, use them.
- -
1. Install QtDesigner and PyQt4. There is a command pyuic4 which should be available after installation. Check that it exists.
- -
2. Using QtDesigner, create your design and save it.
- -
3. Using pyuic4 generate a python file from the design as such 'pyuic4 myfile.ui >myfile.py'. Notice the use of output redirect on this shell command. pyuic4 writes the python script to standard output.
- -
4. Create another python script in your favorite editor. Create a class to extend QtGui..MainWindow and the class just created by pyuic4... Yes, multiple inheritance. One of the benefits of python :-).
- -
5. Use 'self.setupUi(self)'. This invokes a method on the generated super class to construct the window.
- -
6. Each widget is available via the name you gave it in the designer. The rest is up to you.
Awesome job!! You save me a lot of searching with part 4 and 5 !! :) Thank You
stiopka 7 months ago