Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #99272
| From | Santosh Kumar <me@sntsh.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | How to remember last position and size (geometry) of PyQt application? |
| Date | 2015-11-22 18:55 +0530 |
| Message-ID | <mailman.69.1448285797.2291.python-list@python.org> (permalink) |
Hello all fellow Python programmers!
I am using PyQt5 (5.5.1) with Python 3.4.0 (64-bit) on Windows 8.1
64-bit. I don't think this much data was needed. :P
I am having trouble restoring the position and size (geometry) of my
very simple PyQt app.
What I read online is that this is the default behavior and we need to
use QSettings to save and retrieve settings from Windows registry,
which is stored in
`\\HKEY_CURRENT_USER\Software\[CompanyName]\[AppName]\`.
Here are some of the links are read:
http://doc.qt.io/qt-5.5/restoring-geometry.html
http://doc.qt.io/qt-5.5/qwidget.html#saveGeometry
http://doc.qt.io/qt-5.5/qsettings.html#restoring-the-state-of-a-gui-application
and the last one:
https://ic3man5.wordpress.com/2013/01/26/save-qt-window-size-and-state-on-closeopen/
I could have followed those tutorials but those tutorials/docs were
written for C++ users.
C++ is not my glass of beer. Should I expect help from you guys? :)
Here is minimal working application:
import sys
from PyQt5.QtWidgets import QApplication, QWidget
class sViewer(QWidget):
"""Main class of sViewer"""
def __init__(self):
super(sViewer, self).__init__()
self.initUI()
def initUI(self):
self.show()
if __name__ == '__main__':
app = QApplication(sys.argv)
view = sViewer()
sys.exit(app.exec_())
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
How to remember last position and size (geometry) of PyQt application? Santosh Kumar <me@sntsh.com> - 2015-11-22 18:55 +0530
csiph-web