Sunday, September 9, 2018

[Python 3] PyQt5 and Qt Designer

1. Install PyQt
  >> pip install PyQt5

2. Install Qt Designer
  >> pip install PyQt5-tools
 : It is very similar with Matlab GUIDE.
   - Drag and drop components on a layout
   - Modify the attribute of each component
   - Add a function to a corresponding component name

3. Convert *.ui (Qt Designer code) to *.py(Python code)
  >> pyuic5 filename.ui > filename.py -x
   or pyuic5 filename.ui -o filename.py -x
 where, with -x
if __name__ = "__main__"
are included.

Without converting ui to py, ui can be directly loaded to python code as below.

     form_class = uic.loadUiType("automation.ui")[0]



No comments:

Post a Comment