Yea, software evolves.  Things get layered on top of other things.  It’s kind 
of how software works.


Perhaps the point is getting lost here on my request to comment on the overall 
construct and simplicity.  Let’s try a different approach…

How about a quick example that you code up in your favorite GUI?  Try and make 
it simple enough for a beginner to grasp as much as possible.

Here we go:
Take 3 numbers as input (A, B, C).  Add them together.  Display the result in a 
simple pop-up window.

That’s a pretty typical kind of problem for the first few weeks of beginning 
programming.  Maybe first few days.

Let’s say I want my program to look and work like other windows programs.  I 
want to show my friends, mom and dad that I can write software too.  In this 
example, I would expect that kind of reasoning that would drive a desire for a 
GUI.


@mike<mailto:mike_barn...@hotmail.com>

From: Chris Barker <chris.bar...@noaa.gov>
Sent: Friday, August 24, 2018 1:39 PM
To: Paul Moore <p.f.mo...@gmail.com>
Cc: Mike Barnett <mike_barn...@hotmail.com>; Python-Ideas 
<python-ideas@python.org>
Subject: Re: [Python-ideas] A GUI for beginners and experts alike

A couple thoughts:

You're essentially writing a new API on top of tkINter, you could probably have 
multiple "back-ends" -- i.e. be able to use the same code with wxPython or 
PySide behind it.

In fact, there was an effort along these lines a few years back:

http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/<https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.cosc.canterbury.ac.nz%2Fgreg.ewing%2Fpython_gui%2F&data=02%7C01%7C%7C7c6bd9bc319e45a33d8f08d609e89e3f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636707292023975025&sdata=iPZUt3MlLOPPpwAUHdYbXuV3g8iG2JSDgtzd1W9iCyc%3D&reserved=0>

I don't know that it's seen much development lately.

Nope. I don't even have a need for a canvas. But what I have found in the past 
is that *anything* which is a "simple wrapper over X" always ends up in a 
situation where you need some feature from X that the simple wrapper doesn't 
cover, and you're left with the unpalatable choice of whether to omit 
functionality you want to provide, or rewrite your code to use X directly. So 
my question is more about "if you hit a need for something PySimpleGUI doesn't 
cover, what are your options?

This is key -- and one of the real issues around wrapping multiple GUI 
back-ends -- you end up having to do a lot of re-implementation of details.

In fact, I always thought Pyton_guiu above really suffered from that 
conceptually. For example, if you used pyton-gui with a wxPython back end, you 
had:

A python wrapper around a python wrapper around a C++ wrapper around each 
native toolkit.

That's a lot of layers!

So it's probably better to have a simpler stack -- and at the bottom, you 
probably need something with at least some C/C++ in it. And there are two 
options there:

1)  re-implement widgets with native basic drawing and event handling.
  - this is what QT GTK, and TK do
2) Wrap the native widgets
  - this is what wxWidgets does

The advantage of  (1) is that most of your code is the same on all platform, 
widgets behave the same on all platforms, and there is less code to write to 
support a new platform.

The advantage of (2) is that you get more native results -- the widgets ARE 
native. And it's easier to support the first platform -- you aren't writing a 
while GUI toolkit. But there is a lot more wrapper code to write for each new 
platform. And the results ARE going to be a bit platform-dependent in some 
places (though I've found that I need to write very little platform dependent 
code with wx)

TK is essentially (1), though AIUI, it was originally written for X-windows, 
and the other platform have an X-windows emulation layer, and then all the TK 
code works with that.

But the issue with TK is that it's really pretty old and krufty. It's great 
that it comes with the standard library, but now that yu can pip install pySide 
and wxPython, I'd consider working with one of those.

I'd also make sure that you CAN "drop down" into the lower level toolkit fairly 
smoothly, if you do need something more complex that the basics.

Finally -- I'm not sure the desktop is dead, but there is a heck of a lot going 
on in the browser. And if someone could write a simple GUI for a desktop app, 
and then easily prt that to a WebApp -- that would be great.

I'm sure there are toolkits that do maybe it possible to write pure-python, and 
have all the javascript pre-written (Or generated) for you. While its not a 
complete solution, Jupyter Widgets does this within the Jupyter framework, for 
instance.

-CHB












3. It doesn't seem to use native widgets (the buttons have a non-standard look 
on my Windows PC).
The defaults can be easily changed.  The default buttons are the one widget 
that I modify from the system default.  The reason was that the system default 
is a gray button.  It pretty much matches the background.

If you want your buttons to all look like the system default, slip this line of 
code at the top:

sg.SetOptions(button_color=sg.COLOR_SYSTEM_DEFAULT)

OK. Personally, I'd argue quite strongly that "match the OS default" is the 
right default for a GUI library, but that's a hugely subjective area, and 
you're never going to please everyone. So do whatever works for you.

Thank you again Paul... I learn something new from every reply 😊

No problem - glad it helped.

Paul

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org<mailto:Python-ideas@python.org>
https://mail.python.org/mailman/listinfo/python-ideas<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.python.org%2Fmailman%2Flistinfo%2Fpython-ideas&data=02%7C01%7C%7C7c6bd9bc319e45a33d8f08d609e89e3f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636707292023975025&sdata=EPc7GJIUUUGJ6WKLuHA1Pd2a0NWg7srxxB3KXxStDyo%3D&reserved=0>
Code of Conduct: 
http://python.org/psf/codeofconduct/<https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpython.org%2Fpsf%2Fcodeofconduct%2F&data=02%7C01%7C%7C7c6bd9bc319e45a33d8f08d609e89e3f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636707292023975025&sdata=%2FyRXdyWNKldw3HIHuH805QoHAjedAp5CCV91cntZzpE%3D&reserved=0>



--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

chris.bar...@noaa.gov<mailto:chris.bar...@noaa.gov>
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to