Exploring Python for next desktop GUI Project

Zachary Ware zachary.ware+pylist at gmail.com
Thu Jul 24 14:33:29 EDT 2014


On Thu, Jul 24, 2014 at 12:04 PM, Chris “Kwpolska” Warrick
<kwpolska at gmail.com> wrote:
> Tk is neither sane

How so?  Like any other facet of programming, using Tk(inter) has it's
frustrations, but for the most part it has always worked as expected
for me.  Granted, I haven't done anything terribly fancy.

> nor native-feeling, especially on Linux, where it looks
> like something from two decades ago.

The problem there is that on Linux, "native" could mean "GTK", "QT",
or something else entirely.  Also, just to make sure, you are talking
about "ttk" rather than plain "tk", right?

> On other platforms, it also is not 100%
> native.

On Windows, at least, ttk comes very very close to it.

> I personally recommend PyQt4/PySide. wxPython is also worth checking out.

I have used neither of those, but I have seen many people report
happiness with them.  For anyone with experience with those toolkits
in other languages, those would be the obvious choices.

> And it might be better to stay with Python 2, there are still things that
> don't work with Py3k that you might find crucial.

I strongly disagree with this: there's no reason to stick with Python
2 until you have a dependency that you can't get rid of that
absolutely requires Python 2.x.  The fact that "there are still things
that don't work with Py3k" is irrelevant if you don't use them.  And
if you find that, halfway through building your app, you find that you
need to add a dependency that requires Python 2, just backport your
project.  In the majority of cases, it is very easy to port from
Python 3 to either the subset of Python that runs fine in both 2 and
3, or straight to 2.  It may just be a matter of going from:

   import tkinter as tk
   from tkinter import ttk

to:

   try:
       import tkinter as tk
       from tkinter import ttk
   except ImportError:
       import Tkinter as tk
       import ttk

It's not necessarily as easy to go from native Python 2 to 2and3 or 3
due to some incorrect assumptions that Python 2 will let you make, but
even that can be mitigated by writing your Python 2 code with Python 3
in the back of your mind.

-- 
Zach



More information about the Python-list mailing list