Re: Why x+=1 doesn't return x value instead of an object

2020-10-30 Thread Chris Angelico
On Sat, Oct 31, 2020 at 4:44 PM dn via Python-list
 wrote:
> Free advice: whatever you do, don't call @Chris a walrus!

Yeah... I do have quite a moustache, but it doesn't merit a high title
like that! :)

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


Re: Why x+=1 doesn't return x value instead of an object

2020-10-30 Thread dn via Python-list

On 31/10/2020 16:20, Chris Angelico wrote:

On Sat, Oct 31, 2020 at 1:51 PM Jon Ribbens via Python-list
 wrote:


On 2020-10-31, Stefan Ram  wrote:

Siddhharth Choudhary  writes:

I want to know why x+=1 does not return the value of the variable.


   Which value? The old or the new one?

   Expressions never return values.


Except when they're assignment expressions, when they do.


Expressions DO have values, but assignment is a statement, not an
expression. (Assignment expressions don't have augmented forms, so
there's no ambiguity.)



So, you've already realised that:

>>> x = 1
>>> print( x += 2 )
  File "", line 1
print( x += 2 )

isn't going to work.

However it is possible to achieve something of what you ask (Python 
3.8+), using the 'walrus operator' in/as an assignment-expression:


>>> x = 1
>>> print( x := x + 2 )
3

but as others have said, an augmented-expression is not a "named 
expression". Accordingly, the more usual walrus application will be 
something like:


>>> if ( x := 1 + 2 ) > 1.5:
... print( f"Yes! { x }" )
... else:
... print( f"No! { x } <= 1.5" )
...
Yes! 3


Documented in the manual at 
https://docs.python.org/3/reference/expressions.html?highlight=walrus#assignment-expressions


Read more at https://www.python.org/dev/peps/pep-0572/


Free advice: whatever you do, don't call @Chris a walrus!
--
Regards =dn
--
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: Why x+=1 doesn't return x value instead of an object

2020-10-30 Thread Chris Angelico
On Sat, Oct 31, 2020 at 2:41 PM Jon Ribbens via Python-list
 wrote:
>
> On 2020-10-31, Chris Angelico  wrote:
> > On Sat, Oct 31, 2020 at 1:51 PM Jon Ribbens via Python-list
> > wrote:
> >>
> >> On 2020-10-31, Stefan Ram  wrote:
> >> > Siddhharth Choudhary  writes:
> >> >>I want to know why x+=1 does not return the value of the variable.
> >> >
> >> >   Which value? The old or the new one?
> >> >
> >> >   Expressions never return values.
> >>
> >> Except when they're assignment expressions, when they do.
> >
> > Expressions DO have values, but assignment is a statement, not an
> > expression. (Assignment expressions don't have augmented forms, so
> > there's no ambiguity.)
>
> Sorry, could you say that again in English?

An expression has a value. For instance, "x + 1" is an expression; its
value is whatever you get by adding one to x. The expression "lambda
x, y: x + y" also has a value - specifically, a function. Every
expression has a value (unless it raises an exception at runtime).

Statements do not have values. There's no meaningful value in "if x >
2:" or "pass". They do their stuff and that's that.

(Some languages have expressions that can contain statements, such as
function definitions. That doesn't change this, since the value of the
expression is still the function object.)

In Python, "x = 1" is a statement and does not have a value. So is "x
+= 1", which is called an augmented assignment, and it does both
assignment and addition (possibly in-place). There is the special
assignment expression form "x := 1", which does have a value; however,
there's no augmented form "x +:=1" or "x :+= 1", so there's no way for
the augmented form to have a value.

In languages such as C, where augmented assignment is an expression,
it's theoretically possible to write something like this:

x += y -= z *= 3;

This is not good code. Don't do it. But it IS legal. :) The most
common valid uses of assignment as an expression in C are all with the
simple form, such as quickly setting a number of things to the same
value:

x = y = z = 100;

Messing around with augmented forms as expressions is usually a bad
idea. There's one very very specific mutator (technically two - or
four) in C that is useful as an expression, and that's the in-place
increment/decrement operator; and it's very carefully designed so you
get the choice of whether you want the before or the after. You can
write "array[idx++]" to advance to the next slot, or "id = ++max_id"
to claim the next ID and bump up the top marker. This has been
proposed for Python a few times, but the use cases have never been
strong enough to get it added to the language.

I don't think we'll ever see "x += 1" become an expression in Python.

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: Why x+=1 doesn't return x value instead of an object

2020-10-30 Thread Jon Ribbens via Python-list
On 2020-10-31, Chris Angelico  wrote:
> On Sat, Oct 31, 2020 at 1:51 PM Jon Ribbens via Python-list
> wrote:
>>
>> On 2020-10-31, Stefan Ram  wrote:
>> > Siddhharth Choudhary  writes:
>> >>I want to know why x+=1 does not return the value of the variable.
>> >
>> >   Which value? The old or the new one?
>> >
>> >   Expressions never return values.
>>
>> Except when they're assignment expressions, when they do.
>
> Expressions DO have values, but assignment is a statement, not an
> expression. (Assignment expressions don't have augmented forms, so
> there's no ambiguity.)

Sorry, could you say that again in English?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why x+=1 doesn't return x value instead of an object

2020-10-30 Thread Chris Angelico
On Sat, Oct 31, 2020 at 1:51 PM Jon Ribbens via Python-list
 wrote:
>
> On 2020-10-31, Stefan Ram  wrote:
> > Siddhharth Choudhary  writes:
> >>I want to know why x+=1 does not return the value of the variable.
> >
> >   Which value? The old or the new one?
> >
> >   Expressions never return values.
>
> Except when they're assignment expressions, when they do.

Expressions DO have values, but assignment is a statement, not an
expression. (Assignment expressions don't have augmented forms, so
there's no ambiguity.)

ChrisA
-- 
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: Why x+=1 doesn't return x value instead of an object

2020-10-30 Thread Jon Ribbens via Python-list
On 2020-10-31, Stefan Ram  wrote:
> Siddhharth Choudhary  writes:
>>I want to know why x+=1 does not return the value of the variable.
>
>   Which value? The old or the new one?
>
>   Expressions never return values.

Except when they're assignment expressions, when they do.
-- 
https://mail.python.org/mailman/listinfo/python-list


Why x+=1 doesn't return x value instead of an object

2020-10-30 Thread Siddhharth Choudhary
I want to know why x+=1 does not return the value of the variable. It would be 
great if It has returned the value of the variable instead of an object. It 
will increase the beauty of python.
For instance,
  x = 5
  x+=1
  print(x)   = 6
If x+=1 had returned the value instead of object
  x = 5
  print(x+=1)   = 6
which is not possible?
-- 
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: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

2020-10-30 Thread Chris Angelico
On Sat, Oct 31, 2020 at 6:39 AM Gian_Xatzak.  wrote:
>
>When I tried to download  matplotlib, it show me that message in the end:
>
>
>
>ERROR: Command errored out with exit status 1: python setup.py egg_info
>Check the logs for full command output.
>

Did you check the logs? You should find the full command output there.

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


Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

2020-10-30 Thread Gian_Xatzak .
   When I tried to download  matplotlib, it show me that message in the end:

    

   ERROR: Command errored out with exit status 1: python setup.py egg_info
   Check the logs for full command output.

    

   *I have Windows 10, Python3.8.6(64bit)

    

    

   Sent from [1]Mail for Windows 10

    

References

   Visible links
   1. https://go.microsoft.com/fwlink/?LinkId=550986
-- 
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


Best way to determine user's screensize?

2020-10-30 Thread 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.

Thank you!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: GUI: I am also looking for a nudge into the best (GUI) direction.

2020-10-30 Thread flaskee via Python-list
I was actually working on a summarized list for my question.

I thought that I'd produce an up-to-date
list of GUI toolkits, with everyone's responses;
plus what I've cobbled together from comparisons on other sites.




Sent with ProtonMail Secure Email.

‐‐‐ Original Message ‐‐‐
On Thursday, October 29, 2020 10:18 PM, Dan Stromberg  
wrote:

> On Thu, Oct 29, 2020 at 4:48 PM Ethan Furman et...@stoneleaf.us wrote:
>
> > On 10/29/20 11:30 AM, Igor Korot wrote:
> >
> > > If you have any further questions you can contact me directly.
> >
> > Please do not. By keeping the discussion on the list many people can
> > participate and learn.
>
> This list isn't terribly overnoisy.
>
> But sun-managers had a terrific signal/noise ratio back in the day, by
> asking OP's to receive messages off list, and sending a self-composed
> summary of the replies back to the list.
>
> ---
>
> https://mail.python.org/mailman/listinfo/python-list


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


Extract the package list from pypi simple api efficiently.

2020-10-30 Thread Hongyi Zhao
Hi,

The pypi exposes its simple api at , which can be 
used to extract the complete package name list. I want to do the job 
efficiently and write the following simple codes:


import requests
proxies = {
'http': 'socks5h://127.0.0.1:1',
'https': 'socks5h://127.0.0.1:1'
}


requests.packages.urllib3.disable_warnings()
r = requests.get('https://pypi.org/simple/', proxies=proxies, verify=False)


The package name info is included in the r.text string object, but I still 
can't figure out how to further extract them efficiently.


Any hints will be highly appreciated.

Regards,
HY
-- 
https://mail.python.org/mailman/listinfo/python-list