2018年9月6日 星期四

PyQt5 雜記

1.
QtDesigner 存檔後會有一個 .ui 檔
接下來就是把 .ui 檔轉 .py
這時就要用 pyuic5來幫忙了 (pyuic4在Python\Lib\site-packages\PyQt4裡)
pyuic5 input.ui -o output.py

2. PyQt5 with pyinstaller
sip now being installed separately.
https://github.com/pyinstaller/pyinstaller/issues/3630
Upon creating the installer I added the line:

--hidden-import PyQt5.sip

This worked no problem. E.g.

pyinstaller -F --noconsole qt5_10x_dilution_GUI_temp.py --hidden-import PyQt5.sip

3.
當要傳入function名稱,並且function帶有parameters時,用lambda:
self.pushButton.clicked.connect(lambda: handle_input(self.lineEdit, self.label_4, self.label_5, self.label_6))

沒有留言:

張貼留言