Re: Best way to determine user's screensize?

2020-11-03 Thread Peter Pearson
On Sun, 1 Nov 2020 15:31:57 - (UTC), Grant Edwards wrote:
>
> I have no objection to saving the most recent window size and using
> that on the next startup, but I hate applications that force the
> _location_ of the window. I've configured my window manager to open
> windows where I want them opened, please respect that.

Hear, hear!

This user has invested a lot of time learning how to live comfortably
with his window manager.  When some upstart app invalidates that
knowledge and the corresponding deeply ingrained habits, it's a
big annoyance.

-- 
To email me, substitute nowhere->runbox, invalid->com.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-11-02 Thread songbird
Grant Edwards wrote:
> On 2020-11-01, songbird  wrote:
>
>> to keep a program simple i made it to open in the center.
>
> That's not simple: it actually takes _extra_ work to do that.

  this was the first python3 program i wrote, i certainly
do not know python3 or desktop application standards or
much of the other stuff i did, but the program does work
and i'm fine with it as what it is.

  by no means is any program the final statement on any
problem - they are all iterations.  some fail, some go
further.  mayhaps, i'll get further, i can't say at the
present, mainly because my time for programming is not 
that much during the spring/summer/fall.  i'm only taking
a look at this thread because it does touch on issues i'm
curious about and i'm gradually getting more time so 
perhaps there's a chance it will get some updates and 
changes this winter.

  someone commented to me that if that is my attitude then
perhaps nobody will play it.  that's ok, i didn't write it
for anything other a learning experience.  that experience
will perhaps continue...  i may also perhaps get run over
by a mad cow tomorrow and the future will then be left for 
someone else to determine.  :)


>> if i ever get back to it i'll have to figure out how to ask
>> the windowing system what it wants to do for placement
>
> I've never heard of doing that before. I've written lots of desktop
> GUI apps in the past 30 years, and I've never written one line of code
> dealing with the location of the top-level window. I just let the
> toolkit and window manager handle it.

  if there are answers to the following questions this
would go in my file for future efforts.

  1. i'm running Debian testing, lightdm and MATE desktop.

  2. i don't know anything about how those things provide
 information to an application.  pointers would be
 appreciated.

  3. the application is written in python3, using gtk3
 and pyglet.

  it is a very rotten first attempt, i admit that.  :)
but also, for what it is it does work.  note, it does not
work on Windows because i don't have a windows machine
for development and testing nor do i have the inclination
to do that right now (which is why that's not done yet).

  i've posted links to it here before but just so anyone
doesn't have to search for it i'll put the link here too:

  https://github.com/flowerbug/ngfp

  have fun, cheers, etc.  :)


  songbird
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-11-02 Thread Grant Edwards
On 2020-11-01, songbird  wrote:

> certainly it isn't but it is my game and i kept it simple.  if
> people don't like it then they can find something else to play.  i'm
> good with that, but the next time i get back to making changes i'll
> see what i can figure out for saving the location where someone has
> moved it.

I have no objection to saving the most recent window size and using
that on the next startup, but I hate applications that force the
_location_ of the window. I've configured my window manager to open
windows where I want them opened, please respect that.

--
Grant


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-11-02 Thread Grant Edwards
On 2020-11-01, songbird  wrote:

> to keep a program simple i made it to open in the center.

That's not simple: it actually takes _extra_ work to do that.

> if i ever get back to it i'll have to figure out how to ask
> the windowing system what it wants to do for placement

I've never heard of doing that before. I've written lots of desktop
GUI apps in the past 30 years, and I've never written one line of code
dealing with the location of the top-level window. I just let the
toolkit and window manager handle it.



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-11-01 Thread songbird
Mats Wichmann wrote:
> On 10/30/20 6:47 PM, songbird wrote:
...
>>   do you object to a window being put in the approximate
>> center of the screen?
>
> Absolutely!  I'm fighting that on a system which, after an update,
> insists on opening new terminal windows centered - some recent policy
> change is now doing that instead of where the same thing was placed the
> last time it was open (I assume I'll find the knob for that eventually).
>  As others have said, there's no one-size-fits-all; on a big screen you
> certainly don't want the same things as on a phone, where "take over the
> whole screen" might indeed be the only thing that makes sense.

  to keep a program simple i made it to open in the center.
if i ever get back to it i'll have to figure out how to ask
the windowing system what it wants to do for placement and
then store that location as part of the configuration if the
person moves it.

  i don't use multiple screens yet nor do i mind moving an
item once when i'm starting up, but i could see where if 
there are a lot of windows that it would be annoying to 
have to move all of them.


  songbird
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-11-01 Thread songbird
Grant Edwards wrote:
> On 2020-10-31, songbird  wrote:
...
>> do you object to a window being put in the approximate
>> center of the screen?
>
> YES. I've configured my window manager so windows start up where I
> want them to start up. It's none of the application's business where
> it's window is.
>
> When developing an application, try to remember IT'S NOT YOUR
> COMPUTER.

  certainly it isn't but it is my game and i kept it
simple.  if people don't like it then they can find
something else to play.  i'm good with that, but the
next time i get back to making changes i'll see what
i can figure out for saving the location where someone
has moved it.


  songbird
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Dan Stromberg
On Sat, Oct 31, 2020 at 4:18 PM Peter J. Holzer  wrote:

> On 2020-10-31 17:12:36 -0500, 2qdxy4rzwzuui...@potatochowder.com wrote:
> > On 2020-10-31 at 19:24:34 +0100,
> > "Peter J. Holzer"  wrote:
> > > On 2020-10-31 11:58:41 -0500, 2qdxy4rzwzuui...@potatochowder.com
> wrote:
> > > > I never claimed it was easy.  Yes, the author of an MUA has to make a
> > > > guess and a bunch of decisions about a useful default setup (such a
> set
> > > > of defaults already appears elsewhere in this thread).
> > >
> > > Aha. And why would be better to "make a guess" than to use information
> > > available at runtime?
> >
> > Some information, sure.  Please don't assume that physical pixels or
> > physical millimeters of display space relate to useful window sizes.
>
> It does. It's the upper bound. The window may be smaller, but not
> larger.
>
Actually, I think Qt does this (base some parts of layout on the screen's
physical size) at some fundamental level.

Or so I suspect - I don't know for sure just yet.

But if I run a Qt app in TigerVNC (EG keepassxc or an hello world), the app
comes up as just a blank window, or it gives a SIGFPE in konsole while
sizing the window.

And concomitantly xdpyinfo believes that the physical dimensions of the
TigerVNC screen are 0x0mm.

If I do the same thing over plain ssh+X11 tunneling between the same two
hosts, all 3 of those apps work fine, and the dimensions of the screen
aren't 0x0.

In TigerVNC's partial defense, I'm told that in newer versions of TigerVNC
the screen dimensions are no longer 0x0mm.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Serhiy Storchaka
30.10.20 17:56, flaskee via Python-list пишС:
> Perhaps a more tactical approach would best to figure
> out how to do cross-platform python apps.
> 
> What is the best approach to determining the user's available screensize,
> when they open your python application?
> 
> Note that the "desktop" application could be running on Android, iOS,
> MacOS, Windows or Linux (I think that I understand how to handle it for 
> browser-based things.)
> 
> As close to an all Python answer as possible, would be optimal.

It depends on the GUI toolkit you are using.

For example in Tkinter you can use methods winfo_screenwidth() and
winfo_screenheight() of your widget if you need the size in pixels.
winfo_screenmmwidth() and winfo_screenmmheight() return the size in
millimeters.

For other toolkits look at the corresponding documentation.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Peter J. Holzer
On 2020-10-31 17:12:36 -0500, 2qdxy4rzwzuui...@potatochowder.com wrote:
> On 2020-10-31 at 19:24:34 +0100,
> "Peter J. Holzer"  wrote:
> > On 2020-10-31 11:58:41 -0500, 2qdxy4rzwzuui...@potatochowder.com wrote:
> > > I never claimed it was easy.  Yes, the author of an MUA has to make a
> > > guess and a bunch of decisions about a useful default setup (such a set
> > > of defaults already appears elsewhere in this thread).
> > 
> > Aha. And why would be better to "make a guess" than to use information
> > available at runtime?
> 
> Some information, sure.  Please don't assume that physical pixels or
> physical millimeters of display space relate to useful window sizes.

It does. It's the upper bound. The window may be smaller, but not
larger.

> > > But I'm sticking to my story:  that setup should be based on
> > > *application domain* objects, like messages and mailboxes, and not
> > > size(s) of the screen(s) (in pixels or inches).
> > 
> > I'm also sticking to my story that those objects are frequently too
> > large too display completely. They will need a container with a
> > scroll-bar. And then you need to decide how large that container should
> > be.
> 
> Again, I don't think we're disagreeing.  Our shiny new MUA comes up and
> finds 10 million messages in the user's inbox.  Pick a number of
> messages, like 10, or 42, and start there.  Don't start with the screen
> size and do a bunch of font metric arithmetic to come up with a number
> of pixels.

We do disagree fundamentally here. I think picking an arbitrary number
like 10 or 42 out of thin air is fundamentally broken. Computing than
number by dividing the screen height (minus chrome) by the height of one
element is the right thing to do.

(Using the number stored last time when the user resized the window is
of course also ok (because that was the user, not the programmer). But
the application has to be ready to adjust that if the current screen is
smaller)

hp

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread 2QdxY4RzWzUUiLuE
On 2020-10-31 at 19:24:34 +0100,
"Peter J. Holzer"  wrote:

> On 2020-10-31 11:58:41 -0500, 2qdxy4rzwzuui...@potatochowder.com wrote:
> > On 2020-10-31 at 14:37:52 +0100,
> > "Peter J. Holzer"  wrote:
> > 
> > > On 2020-10-31 07:51:38 -0500, 2qdxy4rzwzuui...@potatochowder.com wrote:
> > 
> > > > The intial/default window should be big enough to contain the
> > > > initial/default content, regardless of the configuration of the
> > > > screen(s)/monitor(s).
> > > 
> > > As I already wrote in an answer to Igor, this is only possible if the
> > > initial/default content is of fixed size ...
> > 
> > Bear with me, but I think that that's part of the problem.  Suppose my
> > application edits documents.  The initial content is two buttons, New
> > and Open (I depend on the underlying OS and/or window manager for
> > quitting).  Is the window a fixed size?  No, it's big enough to hold two
> > buttons, sized and scaled based on user supplied defaults, possibly at a
> > lower level, like X11 or Qt.
> 
> In my book that counts as fixed size ...

Then we already have a terminology issue.  :-)

I'll take at least part of the blame because my question as written is
ambiguous:  what I meant to ask was whether or not the application can
specify a predetermined size, in pixels or in millimeters, for that
window.  I believe that the answer is no, because the "correct" size for
that window depends on other things, like the size of the font, the
density of the pixels, user preferences, etc., which can change over
time.  (And my argument remains that said correct size does *not* depend
on the size(s) or the aspect ratio(s) of the screen(s).)

> ... The layout manager can use the information it has (font family and
> size, margins, etc.) compute the sizes of the two buttons, then
> compute the size of the container (possibly using that info to resize
> the buttons), and use that to compute the size of the window. The
> application then requests a window of that size from the window
> manager.

Yep.

> Now consider what happens when the user clicks on that Open button and
> loads the document to be edited. You have to add a text editor widget to
> your window. How large should that be? You know hwo many lines your
> document has, but using a 5000 line text widget for a 5000 line document
> would be ridiculous. You could say "the rest of the window", but your
> window is just large enough for the buttons, so your text widget would
> end up with 0 lines - not very useful. Any fixed size will be too large
> or too small (and while users can usually cope with too small, many of
> them are completely flummoxed by windows which are too large).

The application should pick a size for that widget in lines and columns
of *glyphs*, or a size that matches a potential physical rendering (like
a page in a book) in millimeters, again regardless of the
characteristics of the screen.  Yes, an initial guess may be suboptimal.
Ambitious users can adjust the window and/or their preferences to taste,
and have to recognize that such preferences may depend on other things.
When I switched from a 1920x1080 laptop display to a 3840x2160 laptop
display that was the same size, I had to change a lot of preferences
because applications and font libraries made incorrect assumptions about
pixel density.

I can almost see an application (or a developer) wanting to make that
editing widget, say, 80 characters wide and 2/3 as tall as the screen,
because vertical scroll bars are perfectly acceptable.  Yeah, that'll
look pretty.  Until I (the user) get that wall-size display but I still
want my editing widgets and the text therein to be the same size as my
handwritten notes on real A4 paper.

> Phones are easy: All apps are full-screen (or half-screen, if the OS
> supports that). The app can't request a window size, it has to work
> with what it's got.

That's how video terminals used to be, 80x24, until they weren't.

That's how Apple Macinntosh's used to be, 512x384x1, until they weren't.

You get the idea.  :-)

In Apple's defense, the docs I used in 1984 laid out a completely
heterogeneous display environment, and had instructions for software
that would work when a given window spanned multiple physical display
devices.  I remember how impressed I was when my simple image viewer
worded as advertised when we got our first external color displays.

> > > Very often this is not the case: An image viewer will be used to display
> > > images which are larger than the screen. A MUA may have to display
> > > hundreds of mailboxes, and maybe tens of thousands of mails in a single
> > > mailbox. 
> > 
> > I never claimed it was easy.  Yes, the author of an MUA has to make a
> > guess and a bunch of decisions about a useful default setup (such a set
> > of defaults already appears elsewhere in this thread).
> 
> Aha. And why would be better to "make a guess" than to use information
> available at runtime?

Some information, sure.  Please don't assume that physical p

Re: Best way to determine user's screensize?

2020-10-31 Thread Random832
On Sat, Oct 31, 2020, at 01:26, Igor Korot wrote:
> This one is for "JAVAsucks" -
> https://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html
> This one is for wxWidgets - https://docs.wxwidgets.org/3.0/overview_sizer.html
> This one is for Qt - https://doc.qt.io/qt-5/layout.html
> This one is for GTK -
> https://developer.gnome.org/gtk3/stable/LayoutContainers.html
> 
> Are you still going to argue "it does not exist"?

Those have nothing to do with the sizing or placement of top-level windows, 
they are for placements of widgets within the top-level window.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Peter J. Holzer
On 2020-10-31 11:52:31 -0700, Ethan Furman wrote:
> On 10/31/20 11:24 AM, Peter J. Holzer wrote:
> > On 2020-10-31 11:58:41 -0500, 2qdxy4rzwzuui...@potatochowder.com wrote:
> > > I don't think we're disagreeing too much here, either.  IMO, the user
> > > should be in control, whether by config file or command line or
> > > whatever,
> > 
> > Config files and command lines are inputs to the application. The
> > programmer has to decide what options to accept, what they mean and how
> > to process them. As far as this discussion is concerned, they are
> > strictly part of the application.
> 
> I'm not sure which of the above two snippets I'm (dis)agreeing with, but if
> the user has specified in the config file that they want "full screen", how
> does the application tell the layout manager that?

It doesn't directly. It tells the window manager that it wants to go
full screen. The window manager resizes the window, which causes a
resize event to be sent to the application. The application then asks
the layout manager to recompute the layout based on the new window size
(the latter will probably be managed automatically by the framework, so
the programmer doesn't have to write code for that, but it's still part
of the application).

hp

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Peter J. Holzer
On 2020-10-31 11:54:59 -0500, Igor Korot wrote:
> On Sat, Oct 31, 2020, 8:40 AM Peter J. Holzer  wrote:
> 
> > On 2020-10-31 07:51:38 -0500, 2qdxy4rzwzuui...@potatochowder.com wrote:
> > > On 2020-10-31 at 13:02:03 +0100,
> > > "Peter J. Holzer"  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).
> >
> > As I already wrote in an answer to Igor, this is only possible if the
> > initial/default content is of fixed size (or at least guaranteed to be
> > smaller than the screen size).
> >
> 
> Any control at any given moment has a fixed size.
> If I can't set the initial size of the control in the appropriate layout
> system, then this is not a layout system.

Correct. But you and Chris and others were arguing that this size should
never be based on the screen size. Instead suggestions included "a guess"
and "a reasonable N".


> > Very often this is not the case: An image viewer will be used to display
> > images which are larger than the screen. A MUA may have to display
> > hundreds of mailboxes, and maybe tens of thousands of mails in a single
> > mailbox.
> >
> > In these cases an application can't use the "natural size": It would be
> > bigger than the screen, and depending on the window manager, the user
> > might not even be able to resize it because the handles are off-screen.
> >
> 
> What is natural size? Please define this term.

Depends on the thing to be displayed of course.

For a JPG or PNG image, the "natural size" would be one image pixel =
one display pixel. Except that for small images on high dpi displays it
might be a "logical pixel" (is that the correct term?) instead.

For a a text, the natural size is a box around the complete text typeset
in the way it should be displayed.

Similarly for a list or a table.

A tree has two sizes that could be considered "natural": Fully collapsed
and fully expanded. But it will almost always be somewhere in between,
so that's another situation where a programmer would need to determine
what is reasonable.


> > It could use some size which is small enough to fit on any screen (how
> > large is that? Can you assume 1366x768 these days?). But for most users
> > this would be annoying, since they would have to resize the window.
> >
> > (And note that "the user has to do than only once, the second time the
> > application can use the saved layout" doesn't hold either: The user may
> > have invoked the application on a large desktop monitor the first time,
> > but at some point they use the small laptop monitor or a projector.)
> >
> 
> This is exactly my point.
> If the underlying toolkit is smart enough and the layout system is good
> then it won't matter.

Well. I haven't seen one which is smart enough. It might be because I
don't do desktop development (when I need a UI, I write a web app), but
I think the problem is (in general) unsolvable without domain knowledge,
and so far nobody has written anything to change my mind. I would need
to see either code or at least an explanation how this is done. "It just
works" is not a good argument for a techie.


> > I am very much a fan of letting layout and window managers do as much as
> > possible. But I don't think they can do everything. They simply don't
> > have the necessary information.
> >
> 
> Of course not.
> Thats why software devs are paid big money to do proper designs. πŸ˜€

Well, I have to agree with Chris here. Most programmers (especially
those who are paid big bucks) don't do proper designs.

hp

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Ethan Furman

On 10/31/20 11:24 AM, Peter J. Holzer wrote:

On 2020-10-31 11:58:41 -0500, 2qdxy4rzwzuui...@potatochowder.com wrote:



I don't think we're disagreeing too much here, either.  IMO, the user
should be in control, whether by config file or command line or
whatever,


Config files and command lines are inputs to the application. The
programmer has to decide what options to accept, what they mean and how
to process them. As far as this discussion is concerned, they are
strictly part of the application.


I'm not sure which of the above two snippets I'm (dis)agreeing with, but if the user has specified in the config file 
that they want "full screen", how does the application tell the layout manager that?


(And yes, I have three screens, and each one has a full-size window running in it.  Also, four virtual desktops, one for 
each area of interest.  I hate overlapping windows.)


--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Peter J. Holzer
On 2020-10-31 11:58:41 -0500, 2qdxy4rzwzuui...@potatochowder.com wrote:
> On 2020-10-31 at 14:37:52 +0100,
> "Peter J. Holzer"  wrote:
> 
> > On 2020-10-31 07:51:38 -0500, 2qdxy4rzwzuui...@potatochowder.com wrote:
> 
> > > The intial/default window should be big enough to contain the
> > > initial/default content, regardless of the configuration of the
> > > screen(s)/monitor(s).
> > 
> > As I already wrote in an answer to Igor, this is only possible if the
> > initial/default content is of fixed size ...
> 
> Bear with me, but I think that that's part of the problem.  Suppose my
> application edits documents.  The initial content is two buttons, New
> and Open (I depend on the underlying OS and/or window manager for
> quitting).  Is the window a fixed size?  No, it's big enough to hold two
> buttons, sized and scaled based on user supplied defaults, possibly at a
> lower level, like X11 or Qt.

In my book that counts as fixed size. The layout manager can use the
information it has (font family and size, margins, etc.) compute the
sizes of the two buttons, then compute the size of the container
(possibly using that info to resize the buttons), and use that to
compute the size of the window. The application then requests a window
of that size from the window manager. 

Now consider what happens when the user clicks on that Open button and
loads the document to be edited. You have to add a text editor widget to
your window. How large should that be? You know hwo many lines your
document has, but using a 5000 line text widget for a 5000 line document
would be ridiculous. You could say "the rest of the window", but your
window is just large enough for the buttons, so your text widget would
end up with 0 lines - not very useful. Any fixed size will be too large
or too small (and while users can usually cope with too small, many of
them are completely flummoxed by windows which are too large).



> Placement of the window is up to the
> window manager, which is also ultimately configured by the user.

No argument there. I'm talking about determining the size of widgets.


> > ... (or at least guaranteed to be smaller than the screen size).
> 
> Then how will I *ever* display that 8x10 glossy (with my apologies for
> the idiom; 8x10 inches is a "standard" size for a physical desk photo)
> of yours truly on my phone?

Phones are easy: All apps are full-screen (or half-screen, if the OS
supports that). The app can't request a window size, it has to work with
what it's got.

(Same for web applications: They can't resize the browser, so they have
fit the layout into available space.)

Desktop Applications OTOH can request a window size (and I think they
even have to, at least with X11, and I think also with Windows). So 
the application must somehow determine how large a window it should
request.


> > Very often this is not the case: An image viewer will be used to display
> > images which are larger than the screen. A MUA may have to display
> > hundreds of mailboxes, and maybe tens of thousands of mails in a single
> > mailbox. 
> 
> I never claimed it was easy.  Yes, the author of an MUA has to make a
> guess and a bunch of decisions about a useful default setup (such a set
> of defaults already appears elsewhere in this thread).

Aha. And why would be better to "make a guess" than to use information
available at runtime?

> But I'm sticking to my story:  that setup should be based on
> *application domain* objects, like messages and mailboxes, and not
> size(s) of the screen(s) (in pixels or inches).

I'm also sticking to my story that those objects are frequently too
large too display completely. They will need a container with a
scroll-bar. And then you need to decide how large that container should
be.


> Also, yes, image viewers are different from MUAs.  The latter has to be
> much more aware of certain aspects of the display devices(s), but should
> still base window sizes on *content* rather than choosing to be "full
> screens (plural), because I'm the most important application ever."

I never argued that applications should be full screen. Full screen is
easy (see above). The hard part is figuring out a size which is
acceptable for most users.

(Also, yes, image viewers are different from MUAs, but for the topic at
hand they share an important property: There is no single "correct" size
for the thing(s) they display)


> > In these cases an application can't use the "natural size": It would be
> > bigger than the screen, and depending on the window manager, the user
> > might not even be able to resize it because the handles are off-screen.
> 
> I remember window managers that let applications open windows that I
> can't move.  Aside from a few tricks to "hide" windows, that's a bug.
> 
> > It could use some size which is small enough to fit on any screen (how
> > large is that? Can you assume 1366x768 these days?). But for most users
> > this would be annoying, since they would have to resize the windo

Re: Best way to determine user's screensize?

2020-10-31 Thread Chris Angelico
On Sun, Nov 1, 2020 at 4:10 AM Igor Korot  wrote:
>
> Hi,
>
> On Sat, Oct 31, 2020, 8:40 AM Peter J. Holzer  wrote:
>
> > On 2020-10-31 07:51:38 -0500, 2qdxy4rzwzuui...@potatochowder.com wrote:
> > > On 2020-10-31 at 13:02:03 +0100,
> > > "Peter J. Holzer"  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).
> >
> > As I already wrote in an answer to Igor, this is only possible if the
> > initial/default content is of fixed size (or at least guaranteed to be
> > smaller than the screen size).
> >
>
> Any control at any given moment has a fixed size.

Yes - as determined by the layout manager, NOT the application.

> If I can't set the initial size of the control in the appropriate layout
> system, then this is not a layout system.

Sure, but the initial size should not be defined in pixels - it should
be defined by whatever makes logical sense ("a list box with room to
show these items").

> After the initial size is set it is up to the application to properly give
> the aspect ratio, font sizes, etc when the application is moved between the
> windows, resized, or DPI has changed, etc.

Why? Are you running on a potato where these kinds of basics aren't
handled by the window manager? Get a better window manager.

> > It could use some size which is small enough to fit on any screen (how
> > large is that? Can you assume 1366x768 these days?). But for most users
> > this would be annoying, since they would have to resize the window.
> >
> > (And note that "the user has to do than only once, the second time the
> > application can use the saved layout" doesn't hold either: The user may
> > have invoked the application on a large desktop monitor the first time,
> > but at some point they use the small laptop monitor or a projector.)
> >
>
> This is exactly my point.
> If the underlying toolkit is smart enough and the layout system is good
> then it won't matter.
>
>
> > I am very much a fan of letting layout and window managers do as much as
> > possible. But I don't think they can do everything. They simply don't
> > have the necessary information.
> >
>
> Of course not.
> Thats why software devs are paid big money to do proper designs.
>

And that's why the companies that pay big money to get software devs
to do "proper designs" inevitably end up with pixel-precise rigid
layouts that are utterly unusable on any system the devs didn't test
on.

Meanwhile, people like me - and several others who've posted in this
thread - take the lower-effort option that gives better results. We
define our layouts by rules, and allow the system to define the flow.
Pages like this might be a bit ugly, but I've spent maybe half an hour
working on the layout:

https://sikorsky.rosuav.com/hypetrain?for=devicat

The mobile version took me FAR more effort. I might have put... an
entire hour into this. Maybe even 90 minutes.

https://sikorsky.rosuav.com/hypetrain?for=devicat&mobile=1

Try those on different sizes of screens. Try them on different font
sizes, DPI settings, or anything else you care about. They might not
be the fanciest, they might not be the most showy, but they're not
much more ugly on any other system than they are on my own.

I do the same with desktop layouts too, although it's harder to
showcase that. My Dungeons & Dragons character sheet manager is
entirely rule-based in its GUI, with everything defined as "put a box
here labelled Attributes, and inside it, label/input pairs for STR,
DEX, INT, WIS, CON, CHA". It is *far* easier to maintain than
something where you have to manually lay everything out in pixel
positions.

Why do people get paid big money to make suboptimal designs? Because
the people paying them want something that looks good, not something
that can actually be used by everyone. Because actual usability
testing is incredibly rare. Because it's really hard to put a graph of
how annoyed your customers get with your web site onto a PowerPoint
slide.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Tim Chase
On 2020-10-31 15:22, Grant Edwards wrote:
> > A MUA may have to display hundreds of mailboxes, and maybe tens of
> > thousands of mails in a single mailbox.  
> 
> No. It doesn't. It has to display a tree widget that shows N items
> and holds tens of thousands of items, or a scrolling list widget
> than shows M items and holds tens of thousands of items.  Pick
> reasonable initial default values for N,M and then let the window
> manager and user do the right thing.

But that's exactly the issue.  On my phone, a "reasonable default N"
might be 7 items and consume the whole screen; whereas on my netbook,
a "reasonable default N" might be 15 in one layout or 25 in another;
and on my daily driver, a "reasonable default N" might well be 50 or
100 depending on layout or monitor orientation.

How does the application determine "reasonable"?  It probes the
system for screen dimensions (hopefully with multi-monitor smarts)
and then makes an attempt to paint the display.

This doesn't free it from being subject to a window manager's
subsequent constraints, but at least allows the application to make
some sensible choices for initial defaults.  Some window-managers are
dumb (glares at Windows), some are accommodating (I like how Fluxbox
behaves), some are dictatorial (e.g. tiling window managers that give
far less wiggle-room for applications' dimensions), and some largely
ignore the user ("maximize" on MacOS annoys me to no end, maximizing
only enough to display all the content; when what I want is to obscure
everything else for single-app focus; requiring me to manually resize
the window with the mouse so it fills the screen).

-tkc




-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Igor Korot
Hi,

On Sat, Oct 31, 2020, 12:01 PM <2qdxy4rzwzuui...@potatochowder.com> wrote:

> On 2020-10-31 at 14:37:52 +0100,
> "Peter J. Holzer"  wrote:
>
> > On 2020-10-31 07:51:38 -0500, 2qdxy4rzwzuui...@potatochowder.com wrote:
>
> > > The intial/default window should be big enough to contain the
> > > initial/default content, regardless of the configuration of the
> > > screen(s)/monitor(s).
> >
> > As I already wrote in an answer to Igor, this is only possible if the
> > initial/default content is of fixed size ...
>
> Bear with me, but I think that that's part of the problem.  Suppose my
> application edits documents.  The initial content is two buttons, New
> and Open (I depend on the underlying OS and/or window manager for
> quitting).  Is the window a fixed size?  No, it's big enough to hold two
> buttons, sized and scaled based on user supplied defaults, possibly at a
> lower level, like X11 or Qt.  Placement of the window is up to the
> window manager, which is also ultimately configured by the user.
>

It is also based on the theme used and the screen DPI


> > ... (or at least guaranteed to be smaller than the screen size).
>
> Then how will I *ever* display that 8x10 glossy (with my apologies for
> the idiom; 8x10 inches is a "standard" size for a physical desk photo)
> of yours truly on my phone?
>

πŸ˜€


> > Very often this is not the case: An image viewer will be used to display
> > images which are larger than the screen. A MUA may have to display
> > hundreds of mailboxes, and maybe tens of thousands of mails in a single
> > mailbox.
>
> I never claimed it was easy.  Yes, the author of an MUA has to make a
> guess and a bunch of decisions about a useful default setup (such a set
> of defaults already appears elsewhere in this thread).  But I'm sticking
> to my story:  that setup should be based on *application domain*
> objects, like messages and mailboxes, and not size(s) of the screen(s)
> (in pixels or inches).
>
> Also, yes, image viewers are different from MUAs.  The latter has to be
> much more aware of certain aspects of the display devices(s), but should
> still base window sizes on *content* rather than choosing to be "full
> screens (plural), because I'm the most important application ever."
>

Agreed.
However, the application may start full screen on the first run and let the
user position and size it saving it for restarting.
Or the app can let the WM position it and again let the user place it
saving the position/size for restart.


> > In these cases an application can't use the "natural size": It would be
> > bigger than the screen, and depending on the window manager, the user
> > might not even be able to resize it because the handles are off-screen.
>
> I remember window managers that let applications open windows that I
> can't move.  Aside from a few tricks to "hide" windows, that's a bug.
>
> > It could use some size which is small enough to fit on any screen (how
> > large is that? Can you assume 1366x768 these days?). But for most users
> > this would be annoying, since they would have to resize the window.
>
> It should request the size it wants, and be prepared to handle not
> getting it.  Usually, that means scroll bars.
>
> > (And note that "the user has to do than only once, the second time the
> > application can use the saved layout" doesn't hold either: The user may
> > have invoked the application on a large desktop monitor the first time,
> > but at some point they use the small laptop monitor or a projector.)
>
> Aha!  On this we agree!  :-)
>
> > I am very much a fan of letting layout and window managers do as much
> > as possible. But I don't think they can do everything. They simply
> > don't have the necessary information.
>
> I don't think we're disagreeing too much here, either.  IMO, the user
> should be in control, whether by config file or command line or
> whatever, and not the application inflicting its own ideas on me about
> how to use my screen real estate.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Igor Korot
Hi,

On Sat, Oct 31, 2020, 11:40 AM Grant Edwards 
wrote:

> On 2020-10-31, Peter J. Holzer  wrote:
>
> > Very often this is not the case: An image viewer will be used to
> > display images which are larger than the screen.
>
> Tell the image widget what image you want to display, and then forget
> about it. Let the toolkit and window manager do their jobs.
>

You also should pick an appropriate control for displaying it.
I don't think you can use static window - you should be using something
with the scrollbar, which will size accordingly and display scrollers on
demand.


> > A MUA may have to display hundreds of mailboxes, and maybe tens of
> > thousands of mails in a single mailbox.
>
> No. It doesn't. It has to display a tree widget that shows N items and
> holds tens of thousands of items, or a scrolling list widget than
> shows M items and holds tens of thousands of items.  Pick reasonable
> initial default values for N,M and then let the window manager and
> user do the right thing.
>

Exactly.


> > I am very much a fan of letting layout and window managers do as
> > much as possible. But I don't think they can do everything. They
> > simply don't have the necessary information.
>
> They do in a well-written application.
>

As I said earlier - that's why devs get their money.


> --
> Gran
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Igor Korot
Hi,

On Sat, Oct 31, 2020, 8:40 AM Peter J. Holzer  wrote:

> On 2020-10-31 07:51:38 -0500, 2qdxy4rzwzuui...@potatochowder.com wrote:
> > On 2020-10-31 at 13:02:03 +0100,
> > "Peter J. Holzer"  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).
>
> As I already wrote in an answer to Igor, this is only possible if the
> initial/default content is of fixed size (or at least guaranteed to be
> smaller than the screen size).
>

Any control at any given moment has a fixed size.
If I can't set the initial size of the control in the appropriate layout
system, then this is not a layout system.
After the initial size is set it is up to the application to properly give
the aspect ratio, font sizes, etc when the application is moved between the
windows, resized, or DPI has changed, etc.


> Very often this is not the case: An image viewer will be used to display
> images which are larger than the screen. A MUA may have to display
> hundreds of mailboxes, and maybe tens of thousands of mails in a single
> mailbox.
>
> In these cases an application can't use the "natural size": It would be
> bigger than the screen, and depending on the window manager, the user
> might not even be able to resize it because the handles are off-screen.
>

What is natural size? Please define this term.


> It could use some size which is small enough to fit on any screen (how
> large is that? Can you assume 1366x768 these days?). But for most users
> this would be annoying, since they would have to resize the window.
>
> (And note that "the user has to do than only once, the second time the
> application can use the saved layout" doesn't hold either: The user may
> have invoked the application on a large desktop monitor the first time,
> but at some point they use the small laptop monitor or a projector.)
>

This is exactly my point.
If the underlying toolkit is smart enough and the layout system is good
then it won't matter.


> I am very much a fan of letting layout and window managers do as much as
> possible. But I don't think they can do everything. They simply don't
> have the necessary information.
>

Of course not.
Thats why software devs are paid big money to do proper designs. πŸ˜€

Thank you.


> hp
>
> --
>_  | Peter J. Holzer| Story must make more sense than reality.
> |_|_) ||
> | |   | h...@hjp.at |-- Charles Stross, "Creative writing
> __/   | http://www.hjp.at/ |   challenge!"
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Peter J. Holzer
On 2020-10-31 01:20:39 -, Grant Edwards wrote:
> On 2020-10-30, Peter J. Holzer  wrote:
> 
> > So, assuming the user is invoking the application for the first time,
> > how should an application determine how much of the screen it should
> > use?
> 
> You arrange the widgets the way you want them using the user's
> settings for the toolkit and let the sizers figure out the size.

Ok. I am trying one last time.

Consider a very minimalistic image viewer. It has a menu bar at the top
and shows one image. The path to the image may be passed as sys.argv[1],
in which case it should be immediately displayed. The image should be
displayed in "natural" size but must be scaled down if it doesn't fit.


How do you do that?

You may use any framework, preferrably (since this is a Python group)
a cross-platform framework usable from Python.

hp

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Igor Korot
Hi,

On Sat, Oct 31, 2020, 11:33 AM Grant Edwards 
wrote:

> On 2020-10-31, songbird  wrote:
> > Chris Angelico wrote:
> > ...
> >> I add my voice to those who detest applications that think they know
> >> best and decide that they own the entire screen. It is incredibly
> >> annoying.
> >
> > do you object to a window being put in the approximate
> > center of the screen?
>
> YES. I've configured my window manager so windows start up where I
> want them to start up. It's none of the application's business where
> it's window is.
>
> When developing an application, try to remember IT'S NOT YOUR
> COMPUTER.
>

And its not you that will use an application. So whatever works for you may
not work for user.

Thank you.


>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Igor Korot
Hi,

On Sat, Oct 31, 2020, 8:00 AM Chris Angelico  wrote:

> On Sat, Oct 31, 2020 at 11:53 PM <2qdxy4rzwzuui...@potatochowder.com>
> wrote:
> >
> > On 2020-10-31 at 13:02:03 +0100,
> > "Peter J. Holzer"  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.
>

Amen to that, Chris.

Thank you.


> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread 2QdxY4RzWzUUiLuE
On 2020-10-31 at 14:37:52 +0100,
"Peter J. Holzer"  wrote:

> On 2020-10-31 07:51:38 -0500, 2qdxy4rzwzuui...@potatochowder.com wrote:

> > The intial/default window should be big enough to contain the
> > initial/default content, regardless of the configuration of the
> > screen(s)/monitor(s).
> 
> As I already wrote in an answer to Igor, this is only possible if the
> initial/default content is of fixed size ...

Bear with me, but I think that that's part of the problem.  Suppose my
application edits documents.  The initial content is two buttons, New
and Open (I depend on the underlying OS and/or window manager for
quitting).  Is the window a fixed size?  No, it's big enough to hold two
buttons, sized and scaled based on user supplied defaults, possibly at a
lower level, like X11 or Qt.  Placement of the window is up to the
window manager, which is also ultimately configured by the user.

> ... (or at least guaranteed to be smaller than the screen size).

Then how will I *ever* display that 8x10 glossy (with my apologies for
the idiom; 8x10 inches is a "standard" size for a physical desk photo)
of yours truly on my phone?

> Very often this is not the case: An image viewer will be used to display
> images which are larger than the screen. A MUA may have to display
> hundreds of mailboxes, and maybe tens of thousands of mails in a single
> mailbox. 

I never claimed it was easy.  Yes, the author of an MUA has to make a
guess and a bunch of decisions about a useful default setup (such a set
of defaults already appears elsewhere in this thread).  But I'm sticking
to my story:  that setup should be based on *application domain*
objects, like messages and mailboxes, and not size(s) of the screen(s)
(in pixels or inches).

Also, yes, image viewers are different from MUAs.  The latter has to be
much more aware of certain aspects of the display devices(s), but should
still base window sizes on *content* rather than choosing to be "full
screens (plural), because I'm the most important application ever."

> In these cases an application can't use the "natural size": It would be
> bigger than the screen, and depending on the window manager, the user
> might not even be able to resize it because the handles are off-screen.

I remember window managers that let applications open windows that I
can't move.  Aside from a few tricks to "hide" windows, that's a bug.

> It could use some size which is small enough to fit on any screen (how
> large is that? Can you assume 1366x768 these days?). But for most users
> this would be annoying, since they would have to resize the window.

It should request the size it wants, and be prepared to handle not
getting it.  Usually, that means scroll bars.

> (And note that "the user has to do than only once, the second time the
> application can use the saved layout" doesn't hold either: The user may
> have invoked the application on a large desktop monitor the first time,
> but at some point they use the small laptop monitor or a projector.)

Aha!  On this we agree!  :-)

> I am very much a fan of letting layout and window managers do as much
> as possible. But I don't think they can do everything. They simply
> don't have the necessary information.

I don't think we're disagreeing too much here, either.  IMO, the user
should be in control, whether by config file or command line or
whatever, and not the application inflicting its own ideas on me about
how to use my screen real estate.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Grant Edwards
On 2020-10-31, Peter J. Holzer  wrote:

> You still haven't answered the question: Where should the initial window
> size come from?

The GUI toolkit used by the application calculates a "desired" window
size based on the widgets and layout constraints. That desire is
passed to the window manager, and the window manager then decides
what the winow size is.

> Does your window manager tell the application how large a window
> should be?

Yes.

> And if it does, can you as a user configure that?

Yes.

> I don't think mine (xfce) does that. (I guess tiling WMs generally
> do that, but I've never used one.)

--
Grant



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Ethan Furman

On 10/30/20 6:24 PM, Grant Edwards wrote:

On 2020-10-30, flaskee via Python-list wrote:



but allow the user to alter things, via preferences.


If you want to remember when a user resizes the application and
re-open with that same geometry, that's OK. Doin't it "via
preferences" is right out.


Why is using preferences "right out"?  Is that not the user saying where they 
want the app to be positioned?

--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Grant Edwards
On 2020-10-31, Random832  wrote:
> On Fri, Oct 30, 2020, at 20:18, Igor Korot wrote:
>> Hi,
>> 
>> On Fri, Oct 30, 2020 at 6:59 PM Peter J. Holzer  wrote:
>> > So, assuming the user is invoking the application for the first time,
>> > how should an application determine how much of the screen it should
>> > use? It has to make some choice, and any hard-coded value is almost
>> > certainly wrong. So why should an application not use the screen size as
>> > one factor?
>> 
>> It is not up to application.
>> It is up to the underlying layout system to decide.
>
> What is a "layout system"?

In a GUI toolkit, it's a set of constructs that lets you specify the
relative positions of widgets, which widgets are flexible and which
aren't, and so on. The layout system then determines the sizes of
widgets and windows.

> I don't think such a thing exists, in
> general, for positioning top-level windows on major platforms.

On Linux/Unix, there certainly is. It's called a window manager. There
are many to chose from, and they have various user-configurable
settings that allow the user to control the sizes and positions of
top-level windows.

> Each application has to write its own,

Nonsense.

> and it is reasonable for the layout system itself [which, as I've
> pointed out, is part of the application - there is no such thing as
> a system service] to need access to this information.

There are two levels of layout system services: the GUI
toolkit/framework and the window manager.





-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Chris Angelico
On Sun, Nov 1, 2020 at 3:35 AM Grant Edwards  wrote:
>
> On 2020-10-31, Chris Angelico  wrote:
> >
> >> do you object to a window being put in the approximate
> >> center of the screen?
> >>
> >
> > If that's where my window manager chooses to put it, great! The
> > application just says "I want a window of this size"
>
> But let the widget/toolkit layout engine figure out the size. The
> application developer should just specify what widgets are needed and
> how they are to be arranged. The developer should _not_ be specifying
> window sizes.

Correct. There's effectively a negotiation up and down the chain where
the application itself doesn't care one iota what a "pixel" is, and
its window's size is defined by content. A lot of sizes will be
defined in terms of text ("I want an entry field big enough for 40
characters", which is an approximation of course, but a useful one),
and others might be defined by other things, but the precise pixel
dimensions are up to the layout engine - which should be using native
widgets, which effectively puts the control back in the hands of the
window manager.

And putting control in the hands of the window manager means putting
it in the hands of the user. The user can configure his/her computer
completely. It is not the application's computer, it is the user's.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Terry Reedy

On 10/30/2020 12:05 PM, Grant Edwards wrote:

On 2020-10-30, flaskee via Python-list  wrote:


What is the best approach to determining the user's available
screensize, when they open your python application?


IDLE, based on tkinter based on tcl/tk has a feature to vertically zoom 
an editor window to the full usable height, which is vertical pixel - 
top and or bottom taskbar pixels.  The only way we found to do that is 
to go full screen, get the window size, and revert to previous size. 
Not foolproof (or rather, not expert-proof), but a best-known effor.



All you need to know is how big your application window is. The user's
available screen size is none of your business.


See above.

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Grant Edwards
On 2020-10-31, Peter J. Holzer  wrote:

> Very often this is not the case: An image viewer will be used to
> display images which are larger than the screen.

Tell the image widget what image you want to display, and then forget
about it. Let the toolkit and window manager do their jobs.

> A MUA may have to display hundreds of mailboxes, and maybe tens of
> thousands of mails in a single mailbox.

No. It doesn't. It has to display a tree widget that shows N items and
holds tens of thousands of items, or a scrolling list widget than
shows M items and holds tens of thousands of items.  Pick reasonable
initial default values for N,M and then let the window manager and
user do the right thing.

> I am very much a fan of letting layout and window managers do as
> much as possible. But I don't think they can do everything. They
> simply don't have the necessary information.

They do in a well-written application.

--
Gran

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Grant Edwards
On 2020-10-30, flaskee via Python-list  wrote:

> Funny thing about people who bitch and complain
> and offer no help,

Layout your widgets using appropriate sizers and constraints, and then
let them and the window manager do their jobs. You shouldn't be
messing about with window sizes and locations, or you end up with
abominations like Visual Basic programmers used to produce in the bad
old days.




-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Grant Edwards
On 2020-10-31, Chris Angelico  wrote:
>
>> do you object to a window being put in the approximate
>> center of the screen?
>>
>
> If that's where my window manager chooses to put it, great! The
> application just says "I want a window of this size"

But let the widget/toolkit layout engine figure out the size. The
application developer should just specify what widgets are needed and
how they are to be arranged. The developer should _not_ be specifying
window sizes.

> and the window manager decides where that should go. The application
> doesn't.

Exactly.  Don't try to override the window manager if I've configured
it to open your application in at certain location and/or a certain
window size. It's my computer.


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Grant Edwards
On 2020-10-30, flaskee via Python-list  wrote:

> In odd screen sizes or multi-monitor situations,
> I make the best guess,

Stop guessing. Let the window manager, and layout algorithm do the
jobs for which they were designed.

> but allow the user to alter things, via preferences.

If you want to remember when a user resizes the application and
re-open with that same geometry, that's OK. Doin't it "via
preferences" is right out.


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Grant Edwards
On 2020-10-30, Peter J. Holzer  wrote:

> So, assuming the user is invoking the application for the first time,
> how should an application determine how much of the screen it should
> use?

You arrange the widgets the way you want them using the user's
settings for the toolkit and let the sizers figure out the size.

> It has to make some choice, and any hard-coded value is almost
> certainly wrong.

Definitely, absolutely wrong.

> So why should an application not use the screen size as
> one factor?

Because it's got nothing to do with the appropriate window size for
the application?

Why should the application start out any larger just because the
screen is larger?

--
Grant




-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Grant Edwards
On 2020-10-31, songbird  wrote:
> Chris Angelico wrote:
> ...
>> I add my voice to those who detest applications that think they know
>> best and decide that they own the entire screen. It is incredibly
>> annoying.
>
> do you object to a window being put in the approximate
> center of the screen?

YES. I've configured my window manager so windows start up where I
want them to start up. It's none of the application's business where
it's window is.

When developing an application, try to remember IT'S NOT YOUR
COMPUTER.


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Mats Wichmann
On 10/30/20 6:47 PM, songbird wrote:
> Chris Angelico wrote:
> ...
>> I add my voice to those who detest applications that think they know
>> best and decide that they own the entire screen. It is incredibly
>> annoying.
> 
>   do you object to a window being put in the approximate
> center of the screen?

Absolutely!  I'm fighting that on a system which, after an update,
insists on opening new terminal windows centered - some recent policy
change is now doing that instead of where the same thing was placed the
last time it was open (I assume I'll find the knob for that eventually).
 As others have said, there's no one-size-fits-all; on a big screen you
certainly don't want the same things as on a phone, where "take over the
whole screen" might indeed be the only thing that makes sense.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Peter J. Holzer
On 2020-10-31 07:51:38 -0500, 2qdxy4rzwzuui...@potatochowder.com wrote:
> On 2020-10-31 at 13:02:03 +0100,
> "Peter J. Holzer"  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).

As I already wrote in an answer to Igor, this is only possible if the
initial/default content is of fixed size (or at least guaranteed to be
smaller than the screen size). 

Very often this is not the case: An image viewer will be used to display
images which are larger than the screen. A MUA may have to display
hundreds of mailboxes, and maybe tens of thousands of mails in a single
mailbox. 

In these cases an application can't use the "natural size": It would be
bigger than the screen, and depending on the window manager, the user
might not even be able to resize it because the handles are off-screen.

It could use some size which is small enough to fit on any screen (how
large is that? Can you assume 1366x768 these days?). But for most users
this would be annoying, since they would have to resize the window.

(And note that "the user has to do than only once, the second time the
application can use the saved layout" doesn't hold either: The user may
have invoked the application on a large desktop monitor the first time,
but at some point they use the small laptop monitor or a projector.)

I am very much a fan of letting layout and window managers do as much as
possible. But I don't think they can do everything. They simply don't
have the necessary information.

hp

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Chris Angelico
On Sat, Oct 31, 2020 at 11:53 PM <2qdxy4rzwzuui...@potatochowder.com> wrote:
>
> On 2020-10-31 at 13:02:03 +0100,
> "Peter J. Holzer"  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
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread 2QdxY4RzWzUUiLuE
On 2020-10-31 at 13:02:03 +0100,
"Peter J. Holzer"  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).
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Peter J. Holzer
On 2020-10-30 20:47:50 -0400, songbird wrote:
> Chris Angelico wrote:
> > I add my voice to those who detest applications that think they know
> > best and decide that they own the entire screen. It is incredibly
> > annoying.
> 
>   do you object to a window being put in the approximate
> center of the screen?

Yes, I do. That puts all the windows on top of each other and I have to
move them to a better position.

I have configured my window manager to place new windows so that the
overlap with existing windows is minimised.

hp

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Peter J. Holzer
On 2020-10-31 12:30:43 +1100, Chris Angelico wrote:
> On Sat, Oct 31, 2020 at 10:57 AM Peter J. Holzer  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
> > >  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.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Peter J. Holzer
On 2020-10-30 19:18:22 -0500, Igor Korot wrote:
> On Fri, Oct 30, 2020 at 6:59 PM Peter J. Holzer  wrote:
> > On 2020-10-31 10:02:12 +1100, Chris Angelico wrote:
> > > I add my voice to those who detest applications that think they know
> > > best and decide that they own the entire screen.
> >
> > So, assuming the user is invoking the application for the first time,
> > how should an application determine how much of the screen it should
> > use? It has to make some choice, and any hard-coded value is almost
> > certainly wrong. So why should an application not use the screen size as
> > one factor?
> 
> It is not up to application.
> It is up to the underlying layout system to decide.

This only works if all the GUI elements are of fixed size. 

If you are writing a MUA, for example, there are several elements which
are essentially of arbitrary size: A list or tree of mailboxes. A list
(or forest) of mails in the current mailbox. A pane to display the
current mail. To size these properly you have to know what kind of
information is going to be displayed. Depending on the screen size it
may be better to only show one of them at a time. The application
programmer knows this. The layout system doesn't. This should also be
configurable by the user, which again means that the application has to
a) provide a configuration UI and b) has to be able to set the layout
the way the user configured it.

Layout systems are important and useful. But they are tools, they can't
do everything by themselves. In the end the application programmer has
to decide how to use them.

hp

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-31 Thread Peter J. Holzer
On 2020-10-30 20:08:35 -0700, jf...@ms4.hinet.net wrote:
> What's wrong the OP's question? Why can't just answer it?

Igor already answered it: There is no best way in Python, because it
depends on the framework (and there are many frameworks).

hp

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-30 Thread Igor Korot
Hi,

On Fri, Oct 30, 2020 at 10:44 PM Random832  wrote:
>
> On Fri, Oct 30, 2020, at 20:18, Igor Korot wrote:
> > Hi,
> >
> > On Fri, Oct 30, 2020 at 6:59 PM Peter J. Holzer  wrote:
> > > So, assuming the user is invoking the application for the first time,
> > > how should an application determine how much of the screen it should
> > > use? It has to make some choice, and any hard-coded value is almost
> > > certainly wrong. So why should an application not use the screen size as
> > > one factor?
> >
> > It is not up to application.
> > It is up to the underlying layout system to decide.
>
> What is a "layout system"? I don't think such a thing exists, in general, for 
> positioning top-level windows on major platforms. Each application has to 
> write its own, and it is reasonable for the layout system itself [which, as 
> I've pointed out, is part of the application - there is no such thing as a 
> system service] to need access to this information.

This one is for "JAVAsucks" -
https://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html
This one is for wxWidgets - https://docs.wxwidgets.org/3.0/overview_sizer.html
This one is for Qt - https://doc.qt.io/qt-5/layout.html
This one is for GTK -
https://developer.gnome.org/gtk3/stable/LayoutContainers.html

Are you still going to argue "it does not exist"?

Every cross-platform has a layout system otherwise it will a burden to write
cross-platform apps.

Thank you

Thank you.

> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-30 Thread Chris Angelico
On Sat, Oct 31, 2020 at 2:43 PM Random832  wrote:
>
> On Fri, Oct 30, 2020, at 20:18, Igor Korot wrote:
> > Hi,
> >
> > On Fri, Oct 30, 2020 at 6:59 PM Peter J. Holzer  wrote:
> > > So, assuming the user is invoking the application for the first time,
> > > how should an application determine how much of the screen it should
> > > use? It has to make some choice, and any hard-coded value is almost
> > > certainly wrong. So why should an application not use the screen size as
> > > one factor?
> >
> > It is not up to application.
> > It is up to the underlying layout system to decide.
>
> What is a "layout system"? I don't think such a thing exists, in general, for 
> positioning top-level windows on major platforms. Each application has to 
> write its own, and it is reasonable for the layout system itself [which, as 
> I've pointed out, is part of the application - there is no such thing as a 
> system service] to need access to this information.
>

Window managers most certainly do exist, and they are something that
the user, not the application, controls.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-30 Thread Random832
On Fri, Oct 30, 2020, at 20:18, Igor Korot wrote:
> Hi,
> 
> On Fri, Oct 30, 2020 at 6:59 PM Peter J. Holzer  wrote:
> > So, assuming the user is invoking the application for the first time,
> > how should an application determine how much of the screen it should
> > use? It has to make some choice, and any hard-coded value is almost
> > certainly wrong. So why should an application not use the screen size as
> > one factor?
> 
> It is not up to application.
> It is up to the underlying layout system to decide.

What is a "layout system"? I don't think such a thing exists, in general, for 
positioning top-level windows on major platforms. Each application has to write 
its own, and it is reasonable for the layout system itself [which, as I've 
pointed out, is part of the application - there is no such thing as a system 
service] to need access to this information.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-30 Thread jfong
What's wrong the OP's question? Why can't just answer it?

--Jach
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-30 Thread Chris Angelico
On Sat, Oct 31, 2020 at 10:57 AM Peter J. Holzer  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
> >  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. MANY
applications (mostly games) decide to put themselves on monitor #4 and
size themselves according to monitor #1, or some other mismatching.
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.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-30 Thread 2QdxY4RzWzUUiLuE
On 2020-10-30 at 20:47:50 -0400,
songbird  wrote:

> Chris Angelico wrote:
> ...
> > I add my voice to those who detest applications that think they know
> > best and decide that they own the entire screen. It is incredibly
> > annoying.
> 
>   do you object to a window being put in the approximate
> center of the screen?

At times, yes.  At my last place of employment, I had a lot of screen
real estate.  It's very annoying to be working in a corner of it and
have some kind of modal dialog pop up way over there in the middle of
the screen.  In a dual screen setup when the screens are the same, "the
center of the screen" spans two physical screens.  If the screens are
different, then a window "in the center of the screen" might not even be
fully visible (e.g., two 1920x1080 screens, one portrait and one
landscape, positioned to form an "L").
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-30 Thread Chris Angelico
On Sat, Oct 31, 2020 at 11:51 AM songbird  wrote:
>
> Chris Angelico wrote:
> ...
> > I add my voice to those who detest applications that think they know
> > best and decide that they own the entire screen. It is incredibly
> > annoying.
>
>   do you object to a window being put in the approximate
> center of the screen?
>

If that's where my window manager chooses to put it, great! The
application just says "I want a window of this size" and the window
manager decides where that should go. The application doesn't.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-30 Thread Igor Korot
Hi,

On Fri, Oct 30, 2020 at 7:52 PM songbird  wrote:
>
> Chris Angelico wrote:
> ...
> > I add my voice to those who detest applications that think they know
> > best and decide that they own the entire screen. It is incredibly
> > annoying.
>
>   do you object to a window being put in the approximate
> center of the screen?

As a matter of fact I do.
On Windows there is something called CW_USEDEFAULT.
I'm sure that other OS/toolkits have something similar.

And if not - there is always "Maximize()" and/or Center() and if this
is not desirable
then let the layout system decide.

Thank you.

>
>
>   songbird
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-30 Thread songbird
Chris Angelico wrote:
...
> I add my voice to those who detest applications that think they know
> best and decide that they own the entire screen. It is incredibly
> annoying.

  do you object to a window being put in the approximate
center of the screen?


  songbird
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-30 Thread Igor Korot
Hi,

On Fri, Oct 30, 2020 at 6:59 PM Peter J. Holzer  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
> >  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)
>
>
> > I add my voice to those who detest applications that think they know
> > best and decide that they own the entire screen.
>
> So, assuming the user is invoking the application for the first time,
> how should an application determine how much of the screen it should
> use? It has to make some choice, and any hard-coded value is almost
> certainly wrong. So why should an application not use the screen size as
> one factor?

It is not up to application.
It is up to the underlying layout system to decide.

Thank you.

>
> hp
>
> --
>_  | Peter J. Holzer| Story must make more sense than reality.
> |_|_) ||
> | |   | h...@hjp.at |-- Charles Stross, "Creative writing
> __/   | http://www.hjp.at/ |   challenge!"
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-30 Thread boB Stepp

On Sat, Oct 31, 2020 at 12:56:30AM +0100, Peter J. Holzer wrote:


So, assuming the user is invoking the application for the first time,
how should an application determine how much of the screen it should
use? It has to make some choice, and any hard-coded value is almost
certainly wrong. So why should an application not use the screen size as
one factor?


I have been following this discussion with some interest (except for the
grumpy parts ~(:>)) ), and have wondered this same thing.  Is there any
good guidance on how to answer this question?  Or should it be up to the
combination of GUI toolkit and OS being used?  It seems that if the
programmer does nothing, some default size is generated.

As a user I have not been too concerned about the size presented upon first
using a program.  What gets my dander up is what happens *after* I set the
size I prefer.  Many programs do not store this preference for future runs
of the program or even during the same session when a new window is
generated of the exact same type.  A Windows-based application I use for
work constantly annoys me in this regard, especially when I am working at
home on my (not as wide as Chris') ultra-wide monitor:  I open external
beam planning window for patient #1, resize it.  Open same for next patient
-- must resize once again (...and again, and again, ...).

--
Wishing you only the best,

boB Stepp
--
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-30 Thread Peter J. Holzer
On 2020-10-31 10:02:12 +1100, Chris Angelico wrote:
> On Sat, Oct 31, 2020 at 9:55 AM flaskee via Python-list
>  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)


> I add my voice to those who detest applications that think they know
> best and decide that they own the entire screen.

So, assuming the user is invoking the application for the first time,
how should an application determine how much of the screen it should
use? It has to make some choice, and any hard-coded value is almost
certainly wrong. So why should an application not use the screen size as
one factor?

hp

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-30 Thread flaskee via Python-list


> Funny thing about complaints... you don't hear any from people who
> just uninstall your app and move right on with their lives.
>
> Multi-monitor situations are pretty common. Since you don't seem to
> care about them, I no longer care about your app. Whatever it is, I
> don't need it.
>
> ChrisA


Funny thing about people who bitch and complain
and offer no help, on these kinds of lists,
I don't need them either.

You have No idea what the app is,
No idea how I handle multi-monitors,
etc.

But you have your little opinion anyway.

I am horribly crushed that you won't use my app(s) /s

Bye, bye.



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-30 Thread Igor Korot
Hi,

On Fri, Oct 30, 2020 at 6:24 PM Chris Angelico  wrote:
>
> On Sat, Oct 31, 2020 at 10:17 AM flaskee via Python-list
>  wrote:
> >
> >
> > I'm closing in on the screen width/height, at least.
> >
> >
> > In odd screen sizes or multi-monitor situations,
> > I make the best guess,
> > but allow the user to alter things,
> > via preferences.
> >
> > No complaints in 10 years.
> > So there's that.
> >
>
> Funny thing about complaints... you don't hear any from people who
> just uninstall your app and move right on with their lives.
>
> Multi-monitor situations are pretty common. Since you don't seem to
> care about them, I no longer care about your app. Whatever it is, I
> don't need it.

Exactly.
And since most of such setups are different DPIs it actually becomes more fun.

Especially since some applications tend to save and restore their positions
(not saying this is the case here, but...).

But windows positioning/layout never should be hardcoded and it should
depend on some kind of layout system. All cross-platform toolkit does it -
JAVA, wxWidgets, GTK, Qt.

And so from what I understand - the OP is just trying to re-invent the wheel.
All I can say is - every tool is different.And whatever was good 20 years ago,
today is completely obsolete.

Good luck to him.
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-30 Thread Chris Angelico
On Sat, Oct 31, 2020 at 10:17 AM flaskee via Python-list
 wrote:
>
>
> I'm closing in on the screen width/height, at least.
>
>
> In odd screen sizes or multi-monitor situations,
> I make the best guess,
> but allow the user to alter things,
> via preferences.
>
> No complaints in 10 years.
> So there's that.
>

Funny thing about complaints... you don't hear any from people who
just uninstall your app and move right on with their lives.

Multi-monitor situations are pretty common. Since you don't seem to
care about them, I no longer care about your app. Whatever it is, I
don't need it.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-30 Thread flaskee via Python-list


I'm closing in on the screen width/height, at least.


In odd screen sizes or multi-monitor situations,
I make the best guess,
but allow the user to alter things,
via preferences.

No complaints in 10 years.
So there's that.


# For MacOS Code:
import AppKit [(screen.frame().size.width, screen.frame().size.height) for 
screen in AppKit.NSScreen.screens()]

$ For Windows Code:
from win32api import GetSystemMetrics print("Width =", GetSystemMetrics(0)) 
print("Height =", GetSystemMetrics(1))

# QT Code
from PySide import QtGui
dw=QtGui.QDesktopWidget()
dw.screenGeometry()
dw.availableGeometry() # this is a sub rect of screenGeometry because it e.g. 
ignores the space occupied by the task bar on Windows


# GDK, GTK

from gi.repository import Gdk
s = Gdk.Screen.get_default()
print(s.get_width())
print(s.get_height())

# --

from gi.repository import Gdk, Gtk

# Replace w with the GtkWindow of your application
w = Gtk.Window()
# Get the screen from the GtkWindow
s = w.get_screen()
# Using the screen of the Window, the monitor it's on can be identified
m = s.get_monitor_at_window(s.get_active_window())
# Then get the geometry of that monitor
monitor = s.get_monitor_geometry(m)
# This is an example output
print("Height: %s, Width: %s" % (monitor.height, monitor.width))





-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-30 Thread Chris Angelico
On Sat, Oct 31, 2020 at 9:55 AM flaskee via Python-list
 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.

I add my voice to those who detest applications that think they know
best and decide that they own the entire screen. It is incredibly
annoying.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-30 Thread flaskee via Python-list

‐‐‐ Original Message ‐‐‐
On Friday, October 30, 2020 5:31 PM, Igor Korot  wrote:

> Hi,
>
> On Fri, Oct 30, 2020 at 4:20 PM Random832 random...@fastmail.com wrote:
>
> > On Fri, Oct 30, 2020, at 12:05, Grant Edwards wrote:
> >
> > > Why do you think that's something your application needs to know?
> > > I hate applications that think just because they've been started
> > > they now own the entire computer and everything reachable from it.
> > > All you need to know is how big your application window is. The user's
> > > available screen size is none of your business.
> >
> > The application decides how big the application window is. The user can 
> > resize it, but there's no reason for the screen size not to be one of the 
> > inputs considered for the initial choice.
>
> Nope.
> It is nNOT up to application.
> It is either up to the developer (if he calls Maximize() ) on the main
> frame, or the OS if the main frame is using defaults.
>
> Thank you.
>

Exactly Igor & random832.

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.


Anyway, I'm pushing on to do this under python.
With, or without, Mr. Grouchy.

Igor --- I think you asked why for portrait vs landscape?

It is so that when the user flips a phone or
tablet to the side (landscape), or straight up/down (portrait)
that the widgets can be dynamically resized & re-positioned to fit.

In actionscript a RESIZE event fires when flipping to the side or back,
that can then be reacted to, to reposition things.

I just need to re-figure this all out under Python, et al.

Thanks


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-30 Thread Peter J. Holzer
On 2020-10-30 16:31:25 -0500, Igor Korot wrote:
> On Fri, Oct 30, 2020 at 4:20 PM Random832  wrote:
> >
> > On Fri, Oct 30, 2020, at 12:05, Grant Edwards wrote:
> > > Why do you think that's something your application needs to know?
> > >
> > > I _hate_ applications that think just because they've been started
> > > they now own the entire computer and everything reachable from it.
> > >
> > > All you need to know is how big your application window is. The user's
> > > available screen size is none of your business.
> >
> > The application decides how big the application window is. The user
> > can resize it, but there's no reason for the screen size not to be
> > one of the inputs considered for the initial choice.
> 
> Nope.
> It is nNOT up to application.
> It is either up to the developer

The developer writes the application. The application doesn't decide to
do anything it hasn't been programmed to do. So saying "it is not up the
the application, it is up to the developer" doesn't make any sense.

Oh, and I just realized that "application" is ambiguous. It could mean
the program, or it could be what the program is used for. Of course the
developer should consider the latter when writing the former.

> (if he calls Maximize() ) on the main frame,

An application shouldn't do that unless explicitely directed to by the
user.

> or the OS if the main frame is using defaults.

I'm not sure if OS's even have a default window size. In any case, one
size doesn't fit all. There are many cases where the initial size should
depend on the application:

* A terminal emulator would make the window large enough for a typical
  terminal size (e.g. 80x25 characters) plus chrome.
* An image viewer would make it large enough for the image, but not
  larger than the screen (if the image is larger than the screen (quite
  probable for photos) it will be scaled down).
* A MUA would make it large enough for a list of mailboxes, a list of
  mails and one mail in some default pane configuration, but again not
  larger than the screen.
* A media player would make it large enough for the playlist and some
  chrome.

etc.

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-30 Thread Igor Korot
Hi,

On Fri, Oct 30, 2020 at 4:20 PM Random832  wrote:
>
> On Fri, Oct 30, 2020, at 12:05, Grant Edwards wrote:
> > Why do you think that's something your application needs to know?
> >
> > I _hate_ applications that think just because they've been started
> > they now own the entire computer and everything reachable from it.
> >
> > All you need to know is how big your application window is. The user's
> > available screen size is none of your business.
>
> The application decides how big the application window is. The user can 
> resize it, but there's no reason for the screen size not to be one of the 
> inputs considered for the initial choice.

Nope.
It is nNOT up to application.
It is either up to the developer (if he calls Maximize() ) on the main
frame, or the OS if the main frame is using defaults.

Thank you.

> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-30 Thread Random832
On Fri, Oct 30, 2020, at 12:05, Grant Edwards wrote:
> Why do you think that's something your application needs to know?
> 
> I _hate_ applications that think just because they've been started
> they now own the entire computer and everything reachable from it.
> 
> All you need to know is how big your application window is. The user's
> available screen size is none of your business.

The application decides how big the application window is. The user can resize 
it, but there's no reason for the screen size not to be one of the inputs 
considered for the initial choice.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-30 Thread Igor Korot
Hi,

On Fri, Oct 30, 2020 at 12:26 PM Grant Edwards
 wrote:
>
> On 2020-10-30, flaskee via Python-list  wrote:
>
> > What is the best approach to determining the user's available
> > screensize, when they open your python application?
>
> Why do you think that's something your application needs to know?
>
> I _hate_ applications that think just because they've been started
> they now own the entire computer and everything reachable from it.
>
> All you need to know is how big your application window is. The user's
> available screen size is none of your business.

In addition - what if the user decides to change the monitor DPI?
Then the screen size you retrieved will be useless...

Thank you.

>
> --
> Grant
>
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-30 Thread Grant Edwards
On 2020-10-30, flaskee via Python-list  wrote:

> What is the best approach to determining the user's available
> screensize, when they open your python application?

Why do you think that's something your application needs to know?

I _hate_ applications that think just because they've been started
they now own the entire computer and everything reachable from it.

All you need to know is how big your application window is. The user's
available screen size is none of your business.

--
Grant

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-10-30 Thread Igor Korot
Hi,



On Fri, Oct 30, 2020, 10:59 AM flaskee via Python-list <
python-list@python.org> wrote:

> Perhaps a more tactical approach would best to figure
> out how to do cross-platform python apps.
>
> What is the best approach to determining the user's available screensize,
> when they open your python application?
>

It depends on the framework you are using...

Thank you.


> Note that the "desktop" application could be running on Android, iOS,
> MacOS, Windows or Linux (I think that I understand how to handle it for
> browser-based things.)
>
> As close to an all Python answer as possible, would be optimal.
>
> Thank you!
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list