Best way to determine user's screensize?
Peter J. Holzer
hjp-python at hjp.at
Sat Oct 31 08:02:03 EDT 2020
On 2020-10-31 12:30:43 +1100, Chris Angelico wrote:
> On Sat, Oct 31, 2020 at 10:57 AM Peter J. Holzer <hjp-python at hjp.at> wrote:
> > On 2020-10-31 10:02:12 +1100, Chris Angelico wrote:
> > > On Sat, Oct 31, 2020 at 9:55 AM flaskee via Python-list
> > > <python-list at python.org> wrote:
> > > > I have done all of this resizing and layout stuff before.
> > > >
> > > > I just ignored the grouchy user with the hate over me wanting screensize.
> > > > (every list has one of those types, eh? :-)
> > > >
> > > > Screensize, in part, determines the aspect ratio calcs to dynamically
> > > > resize and place the components on the screen.
> > > >
> > >
> > > So what would you do if it turns out that my screen is 5440 x 2104?
> > > That's what mine is right now.
> >
> > That depends on the application.
> >
> > If for example the application is in image viewer and the image to be
> > viewed is 4576x3432 pixels large, that wouldn't fit on the screen.
> > Assuming 200 pixels of vertical chrome (title bar, window borders, menu
> > bar and/or buttons), the image would have to be resized to (at most)
> > 2539x1904 pixels. So the window would be sized to accommodate that.
> >
> > (If you use a multi-screen setup, the calculation should be based on
> > the current screen, of course, not on the combined size of all screens)
> >
>
> But what is the "current screen"? That's the problem.
The one where the window manager decided to put the window?
(Ok, there may be a bit of a catch-22 here: You might want that
information before actually creating the window, but the window manager
can only place the window once it's created. Plus the placement might
depend on the size.)
> MANY applications (mostly games) decide to put themselves on monitor
> #4 and size themselves according to monitor #1, or some other
> mismatching.
Well, that's obviously a bug. (Presumably the programmer didn't expect
there to be more than one screen, or at least not screens of different
sizes.)
> Or, I alt-tab away from something, come back in, and it resizes itself
> to a different screen size.
>
> 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.)
hp
--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp at hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://mail.python.org/pipermail/python-list/attachments/20201031/bcd9d7b2/attachment.sig>
More information about the Python-list
mailing list