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))
2018年9月6日 星期四
PyQt5 set window flags for MinimizeButton, MaximizeButton
pyQt5 change MainWindow Flags
Every call of
setWindowFlags
will completely override the current settings, so you need to set all the flags at once. Also, you must include the CustomizeWindowHint
flag, otherwise all the other hints will be ignored. The following will probably work on Windows: self.setWindowFlags(
QtCore.Qt.Window |
QtCore.Qt.CustomizeWindowHint |
QtCore.Qt.WindowTitleHint |
QtCore.Qt.WindowCloseButtonHint |
QtCore.Qt.WindowStaysOnTopHint
)
However, it is highly unlikely this will work on all platforms. "Hint" really does mean just that. Window managers are completely free to ignore these flags and there's no guarantee they will all behave in the same way.
PS:
It is not possible to set the window flags in Qt Designer.
PyQt window flags
PyQt has these window flags:
PyQt has these window flags:
- Qt.MSWindowsFixedSizeDialogHint
- Qt.X11BypassWindowManagerHint
- Qt.FramelessWindowHint
- Qt.WindowTitleHint
- Qt.WindowSystemMenuHint
- Qt.WindowMinimizeButtonHint
- Qt.WindowMaximizeButtonHint
- Qt.WindowCloseButtonHint
- Qt.WindowContextHelpButtonHint
- Qt.WindowShadeButtonHint
- Qt.WindowStaysOnTopHint
- Qt.WindowStaysOnBottomHint
- Qt.CustomizeWindowHint
訂閱:
文章 (Atom)