Best way to determine user's screensize?

Chris Angelico rosuav at gmail.com
Sat Oct 31 08:57:08 EDT 2020


On Sat, Oct 31, 2020 at 11:53 PM <2QdxY4RzWzUUiLuE at potatochowder.com> wrote:
>
> On 2020-10-31 at 13:02:03 +0100,
> "Peter J. Holzer" <hjp-python at hjp.at> wrote:
>
> > On 2020-10-31 12:30:43 +1100, Chris Angelico wrote:
>
> > > There is no valid way for an application to read my mind and size
> > > itself. Attempting to query my screen size seems to just make things
> > > worse in a lot of situations.
>
> > You still haven't answered the question: Where should the initial
> > window size come from? Does your window manager tell the application
> > how large a window should be? And if it does, can you as a user
> > configure that? I don't think mine (xfce) does that. (I guess tiling
> > WMs generally do that, but I've never used one.)
>
> The intial/default window should be big enough to contain the
> initial/default content, regardless of the configuration of the
> screen(s)/monitor(s).  "The GUI," whether it's something near the
> bottom, like X11, or something more complicated, like GTK or Qt, should
> have the information and/or the API to make the widgets usable and the
> text readable, possibly based on user configuration (e.g., I like 6
> point type on my 288dpi laptop display; other people might like 12 point
> type on their 72dpi big screen monitor).

This. The window manager gets information from the internal layout
manager, but the application itself shouldn't care. I should be able
to build a window by saying "it should have a notebook, and that
notebook should have a label saying Name and an input big enough for
20 characters, and below that a label saying Class and a drop-down
with options Wizard, Cleric, Fighter, etc, etc, etc, etc". At no point
should pixel sizes or screen sizes be within the scope of my
application.

ChrisA


More information about the Python-list mailing list