PySide window does not resize to fit screen

Laura Creighton lac at openend.se
Thu Oct 1 12:19:12 EDT 2015


In a message of Thu, 01 Oct 2015 06:44:25 -0700, Hedieh Ebrahimi writes:
>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.

screenGeometry = QApplication.instance().desktop().screenGeometry()
to find out your desktop size in pixels.
availGeometry = QApplication.instance().desktop().availableGeometry()
is the same thing minus the space for the task bar, so maybe more
useful.

width, height = availGeometry.width(), availGeometry.height()

Finding out what pyside thinks the size is can be useful for debugging
problems, but this stuff should already be happening automatically.  There is
something not quite right with your layout, and brutally resizing things
by hand is treating the symptom, not the cause.

Laura




More information about the Python-list mailing list