[Python-ideas] A GUI for beginners and experts alike

Chris Barker chris.barker at noaa.gov
Fri Aug 24 13:39:19 EDT 2018


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/

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 at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
>


-- 

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.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180824/50d97f06/attachment-0001.html>


More information about the Python-ideas mailing list