Skip to content

Instantly share code, notes, and snippets.

@jesperrix
Created May 24, 2014 09:54
Show Gist options
  • Select an option

  • Save jesperrix/1484975ed496448e8912 to your computer and use it in GitHub Desktop.

Select an option

Save jesperrix/1484975ed496448e8912 to your computer and use it in GitHub Desktop.
Create Gui with Qt Designer and generate python code from it
Install PyQt
brew install pyqt
1. Create UI with Qt Designer
On Your Desktop machine
Open Qt Designer and create a gui and save it as a file.ui
Example pic: http://farm3.static.flickr.com/2790/4337163813_3da33c11e3.jpg
2.Generate your Python code.
Open a command window and write following command
pyuic4 -x filename.ui -o filename.py -x generates additional code to allow you to test the ui element the -o tells it where to store the python "executable".
Now run the file generated from the command to test
@Yan-niss
Copy link

Thanks! Have you found any way to add comments to the output python file or even better divide it into sections?
The way Qt designer works is very helpful, but the python output code is not very intuitive if you want to find/edit a module (ie. button, etc.) especially for more complicated GUIs.
Any idea on how to divide the code in sections or add comments from the designer program? :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment