Getting back into PyQt and not loving it.

Mark Summerfield list at qtrac.plus.com
Mon Jun 27 03:33:25 EDT 2016


On Monday, June 27, 2016 at 3:12:34 AM UTC+1, MRAB wrote:
[snip]
> > Not sure that wxPython is really any different in that respect, and Tkinter doesn't feel Pythonic to me, either -- considering how it's Tk at heart.  So what's the alternative?  There really is no good Python-based GUI tool, and that's a shame.
> >
> Is it a problem with Tk itself or with the Python wrapper? Would it be 
> better if we made a more Pythonic version of Tkinter, e.g. making 
> Frame.title a property?

My main complaints about Tkinter are:

- Not very Pythonic.

- The event handling works very differently from other toolkits so it can be quite tricky to learn and get right.

- The bindings are incomplete (e.g., http://bugs.python.org/issue3405)

And for me there are show-stopping weaknesses.

- Show stopper #1: there is no nice way to create custom widgets. Compare with PySide, PyQt (& wxPython I believe) where you can inherit some "widget" base class and paint it however you like and do any event handling you like to get custom appearance and behaviour. Sure, you can do this with canvas as the base, but it seems like you have do do far more work in Tkinter than the other toolkits.

- Show stopper #2: there doesn't seem to be any way to create one line and multiline styled text editors (e.g., supporting bold, italic, underline, superscript, subscript, colour, font). The text widget can display all these (and more) but I haven't found any way to get it to be able to provide _editing_ of all these. (You can get it to do bold, italic, underline, and colour, but I certainly can't get these plus super- and sub-script and font support from Python. Nor is there any useful load/save in HTML or any other format.)

Hopefully people will point me to docs or examples to prove me wrong about these weaknesses:-)

Or better still, maybe the seemingly moribund PyGUI project could be revived or maybe someone will create bindings for libui or for IUP so that Python could have a lightweight GUI-only cross-platform library that had decent support for creating custom widgets in Python but left all non-GUI functionality to the rest of the Python ecosystem.



More information about the Python-list mailing list