I want show my project main window in the middle of the screen . when i call "self.show()" then the window show in the middle of the screen .
相关问题
- QTextEdit.find() doesn't work in Python
- Pyside, PyQt4: How to set a validator when editing
- Pillow (PIL) to QImage conversion -> python.exe ha
- QTableView: sort by header index -1
- QVariant in QComboBox (Python 2 vs Python 3)
相关文章
- Getting all items of QComboBox - PyQt4 (Python)
- How to update a realtime plot and use buttons to i
- mouseDoubleClickEvent with QLineEdit
- Emitting signals from a QRunnable
- How do I make pyinstaller include my database?
- findChild on object created within pyqt designer
- How to choose value from an option list using PyQt
- Increase Height of QPushButton in PyQT
I know you have already solved it, but I make this answer for those who have the same question. I post it mainly because you asked for pyQt and the other answer is for Qt (C++). I found a workaround here: https://bashelton.com/2009/06/pyqt-center-on-screen/
Is so simple and works perfectly, I transmit it..
Good luck!
First I would recommend against trying to force a window position on your users and let the system's window manager decide where it should go. If you really insist on positioning it yourself (perhaps you are programming for a kiosk), you can find some information here in a previous question on stackoverflow.
A slightly more elegant calculation for doing this is discussed here.
When doing this calculation, it is important that it is done at the correct time, after Qt has resized everything and just before it is shown on screen. One method that might help is to create a one-shot timer and do the screen positioning in the slot for the timer.