Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #99272

How to remember last position and size (geometry) of PyQt application?

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Santosh Kumar <me@sntsh.com>
Newsgroups comp.lang.python
Subject How to remember last position and size (geometry) of PyQt application?
Date Sun, 22 Nov 2015 18:55:29 +0530
Lines 45
Message-ID <mailman.69.1448285797.2291.python-list@python.org> (permalink)
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de /bV1XlWL/+YuHMPz5+GB4AYUwPt2VrZKjoRV4O9J4Ngg==
Return-Path <me@sntsh.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.013
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'sys': 0.05; '__name__': 0.07; 'subject:application': 0.07; 'subject:How': 0.09; 'skip:` 50': 0.09; 'subject:position': 0.09; 'stored': 0.10; 'python': 0.10; 'def': 0.13; "'__main__':": 0.16; 'guys?': 0.16; 'read:': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:PyQt': 0.16; 'app': 0.16; 'settings': 0.20; 'windows': 0.20; 'needed.': 0.23; 'tutorials': 0.23; 'import': 0.24; 'written': 0.24; 'followed': 0.27; 'message-id:@mail.gmail.com': 0.27; 'skip:q 20': 0.29; 'minimal': 0.30; 'subject:last': 0.30; 'users.': 0.31; 'skip:_ 10': 0.32; 'subject:) ': 0.32; 'class': 0.33; 'received:google.com': 0.35; 'trouble': 0.35; 'could': 0.35; 'c++': 0.35; 'but': 0.36; 'should': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'expect': 0.37; 'received:209': 0.38; 'data': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'save': 0.60; 'behavior': 0.61; 'default': 0.61; 'url:26': 0.66; 'here': 0.66; 'online': 0.71; 'url:wordpress': 0.79; '8.1': 0.84; 'glass': 0.84; 'received:111': 0.84; 'subject:remember': 0.91; 'url:2013': 0.91
DKIM-Signature v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sntsh.com; s=default; h=Content-Type:To:From:Subject:Message-ID:Date:MIME-Version; bh=axVPc+mssrPxlWy4aUK1HYyHiy+ygAn1x4U19DcsO2k=; b=i1fpOZPUz0gz40BJOmWumbgQXwpZdL/e+u3F71TIaz9GY4Rl+ZwZsXLuDlrrVj2ve7sg9L9/L4iuwscbbJ829Nm+gMKpxSZae4vs5kbCPE9OK3gF6Xs4NsGIPcUEI47n2GwC/LPaI6+6JvRIfasCAMXYFR3ioV/uXDBwqrVDDzg=;
X-Received by 10.112.136.136 with SMTP id qa8mr9065337lbb.14.1448198729513; Sun, 22 Nov 2015 05:25:29 -0800 (PST)
X-Gmail-Original-Message-ID <CAE7MaQZj=smhVjxBzv2osAYEL8wVGbiwB3LJ2sPDx2trNWPUaA@mail.gmail.com>
X-Authenticated_sender me@sntsh.com
X-OutGoing-Spam-Status No, score=-1.0
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - md-in-26.webhostbox.net
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - sntsh.com
X-Get-Message-Sender-Via md-in-26.webhostbox.net: authenticated_id: me@sntsh.com
X-Source
X-Source-Args
X-Source-Dir
X-Mailman-Approved-At Mon, 23 Nov 2015 08:36:36 -0500
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:99272

Show key headers only | View raw


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


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