Path: csiph.com!eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'cc:addr:python-list': 0.09; 'buttons': 0.09; 'grid': 0.09; 'whichever': 0.09; '\xe2\x80\x94': 0.09; 'advance': 0.10; 'subject:not': 0.11; 'size,': 0.13; 'code?': 0.16; 'hand?': 0.16; 'resize': 0.16; 'screen,': 0.16; 'subject:screen': 0.16; 'wrote:': 0.16; 'app': 0.16; 'exists': 0.18; 'widget': 0.18; 'all,': 0.20; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'bar.': 0.22; 'cc:no real name:2**0': 0.22; 'header:In-Reply-To:1': 0.24; 'chris': 0.26; 'message-id:@mail.gmail.com': 0.27; 'correct': 0.28; 'fine': 0.28; 'interface': 0.29; 'looks': 0.29; 'skip:q 20': 0.29; 'url:mailman': 0.30; 'code': 0.30; 'window': 0.30; 'screen': 0.32; 'are:': 0.32; 'url:python': 0.33; 'url:listinfo': 0.34; '(for': 0.34; 'received:google.com': 0.35; 'designer': 0.35; 'but': 0.36; 'url:org': 0.36; 'tool': 0.36; 'depends': 0.36; 'smaller': 0.36; 'subject:: ': 0.37; 'thanks': 0.37; 'does': 0.39; 'application': 0.39; 'url:mail': 0.40; 'some': 0.40; 'your': 0.60; 'details': 0.62; 'more': 0.63; 'information': 0.63; 'laptop': 0.67; 'dear': 0.67; 'layout.': 0.84; 'hand,': 0.97 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=Mi9Nm1e3Xh3n+9raRf81tTEdCJP+PEyAaRYs7Ab8io8=; b=kNk7tA++jW/VAS2ZOCh3EdnfKD6BkMhO7iIwctX6qqb+iJkab5NOJ/FQZmLvs3cIYT 0QjihAlOW6hAI8oO/UQAX8cR1DmLeBMrBB9SR4mrk336pT9MoQbkH2jiNLn8Hva/4ZG8 6FtYJqav8XsPWbyBpwiY0dMbPmu4/4pkJ+hL5U8PfVaZzOQTh14y7XU4pKoMHyA4J9HE pm+02TrJo6+fOWEpD4dKSMpJZDO1cuLRtBQvCLG2gMDkPTMQA41ZlrYnSuqie+yVWeCx cueNI29DUCKmaffkd+Fk7Bh/yR2FRUx8Pdqj++RJd9OXDir4tPVTfUKYPvjW+JmkYuEk WM7g== MIME-Version: 1.0 X-Received: by 10.31.9.212 with SMTP id 203mr7339350vkj.74.1443712029373; Thu, 01 Oct 2015 08:07:09 -0700 (PDT) In-Reply-To: <24851466-7de1-408f-a0a0-548d42d21ab4@googlegroups.com> References: <24851466-7de1-408f-a0a0-548d42d21ab4@googlegroups.com> Date: Thu, 1 Oct 2015 17:07:09 +0200 Subject: Re: PySide window does not resize to fit screen From: Chris Warrick To: Hedieh Ebrahimi Cc: python-list@python.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 42 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1443712037 news.xs4all.nl 23824 [2001:888:2000:d::a6]:49853 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:97285 On 1 October 2015 at 15:44, Hedieh Ebrahimi wrote: > Dear all, > > I am using Pyside to create a user interface for my app. > The app works fine on my computer with big screen, but when I take it to = my laptop with smaller screen size, it does not resize to match the screen = size. > > How can I make my main widget get some information about the screen size = and resize automatically? > > Thanks in Advance for your answers. > -- > https://mail.python.org/mailman/listinfo/python-list The correct way to do this is to lay your application out using a layout. The available layouts are: * QHBoxLayout * QVBoxLayout * QGridLayout * QFormLayout The exact layout to use depends on your needs. What are you using to create your Qt code? Are you using Qt Designer or are you writing the code by hand? If you are using Qt Designer, use the =E2=80=9CLay Out=E2=80=A6=E2=80=9D buttons in the Form menu or on t= he tool bar. If you are writing Qt code by hand, it looks roughly like this (for a VBox; Grid and Form are more complicated as they involve positioning): lay =3D QtGui.QVBoxLayout(self) # your central widget, dialog, main window =E2=80=94 whichever one exists btn =3D QtGui.QButton("Hello", lay) lay.addWidget(btn) Please check with Qt documentation for more details --=20 Chris Warrick PGP: 5EAAEA16