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

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Aug 24 19:56:16 EDT 2018


Chris Barker via Python-ideas wrote:

> 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.

It hasn't, sorry to say. Turns out that writing and maintaining
what is effectively 3 complete GUI toolkits takes a more
copious supply of round tuits than I have at the moment. :-(

> 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.

If you're talking about my PyGUI project, using it with
wPython doesn't really make sense.

I specifically wanted to avoid the multiple-wrapper problem,
so I decided *not* to wrap any existing cross-platform GUI
toolkit. The goal is to provide exactly one high-quality
implementation for each platform, with as few layers as
practicable between the Python API and the platform's native
GUI facilities.

One result of that is that PyGUI is not really structured as
a "front end" and "back end" with a defined interface between
them. There is generic code and platform-specific code, but
they're fairly closely intertwined. Implementations on top
of wxPython, Qt etc. could probably be created, but I won't be
doing it myself, because it would take a lot of work and
I don't think it would be necessary or desirable.

> 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

PyGUI does (2).

> 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.

Yeah, X Windows is a bit special, because there is no such
thing os a "native" look and feel for widgets on X -- there
have been multiple GUI toolkits for X from the beginning,
each with its own style. So Tk inventing a new one all of
its own wasn't really a bad thing at the time.

> 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.

PyGUI provides everything you need to create a custom widget,
without needing to go down to a lower level.

You could also create a wrapper for a native widget that
PyGUI doesn't already provide, but the techniques for doing
so are currently undocumented and might change between
releases.

> 
> 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.

Pyjamas seems to be something like that:

https://pypi.org/project/Pyjamas/

-- 
Greg


More information about the Python-ideas mailing list