Python and Tkinter Programming by John Grayson
peter.milliken at gmail.com
Thu Jan 21 22:30:29 CET 2010
On Jan 15, 9:12 am, Kevin Walzer <k... at codebykevin.com> wrote:
> On 1/14/10 3:39 PM, Peter wrote:
> > On Jan 15, 6:24 am, Mark Roseman<m... at markroseman.com> wrote:
> >> Peter<peter.milli... at gmail.com> wrote:
> >>> Besides, the book is mainly about using Python with Tkinter - and
> >>> Tkinter hasn't changed that much since 2000, so I believe it is just
> >>> as relevant today as it was back then.
> >> I'd say that Tkinter has substantially changed - with the introduction
> >> of the 'ttk' themed widgets. I cover these in my tutorial athttp://www.tkdocs.com
> >> Mark
> > But is the ttk themed widgets a "change" to Tkinter or an "addition/
> > improvement"? i.e. does the themed widgets invalidate any of the
> > Tkinter stuff in Grayson's book? That certainly isn't my impression of
> > the themed widgets, I was of the impression that the themed widgets
> > just added some convenient widgets (such as Scale, Spinbox etc) which
> > a user could find in other GUI frameworks, for example, Pmw
> > supplemented the basic Tkinter widget set and offered some (essential
> > IMO) widgets that were missing in Tkinter - such as the Notebook
> > widget.
> It's both a change and an improvement. The themed widgets can be used in
> conjunction with the traditional widgets, but in many cases it's
> possible (and desirable) to update your entire application to use the
> themed widgets.
> > Lets face it, if somebody wants to get up to speed on Python and GUI
> > development then the book is still very, very relevant and necessary
> > (IMO). The documentation for the themed widgets still leaves a lot to
> > be desired from the perspective of somebody who wants to start using
> > Python to create GUI applications. As Lord Eldritch reminded me in his
> > post, the book even has a section on Pmw - which is what I use mainly
> > for my GUI applications - because Tkinter was missing some vital
> > widgets that are now available in the ttk themed set.
> > Personally I will start to incorporate some of the ttk themed widgets
> > into my applications - but Pmw will remain the 'basis' for my GUI's as
> > the entire framework (IMO) supports a class oriented approach that
> > allows easy creation of extensible and reconfigurable (at run time)
> > GUI interfaces.
> PMW is certainly a helpful addition to the Tkinter developer's toolbox,
> but it also has limitations. It suffers from some of the same
> limitations as Tk itself, i.e. it is rather dated in appearance, and
> even it lacks some modern UI features such as a good multicolumn
> listbox, treeview, etc. In addition to the ttk themed widgets, other,
> more configurable pure Tk-based megawidget packages exist, such as
> BWidgets and Tablelist, and there are Python wrappers for these at the
> Tkinter wiki (http://tkinter.unpythonic.net/wiki/).
> > Ultimately Grayson does a good job of providing information and
> > reference to toolkit(s) that allow a beginner to quickly get up to
> > speed on producing a GUI using Python. It is purely up to the user
> > afterwards as to whether they stick with Tkinter/Pmw (and now the ttk
> > themed set) or venture into wxPython or Jython (as two examples of GUI
> > 'systems' that provide 'better' facilities to a Python programmer).
> Another book I've found very helpful for learning Tkinter is Programming
> Python by Mark Lutz--a lot of coverage there of GUI development.
> Kevin Walzer
> Code by Kevinhttp://www.codebykevin.com
Another possible consideration when choosing a GUI to learn Python -
will you want to print from within your GUI application? Admittedly, I
haven't looked to see whether this situation has changed or not for
some years now, but a GUI based on Tkinter (whether it is ttk or Pmw
or whatever) has no support for "printing". Other GUI frameworks, such
as wxPython, Jython, PyQT etc have API's that allow printing of
information from within your GUI application.
Now if you go the Tk route, I am sure you can use the Win32 bindings
to do printing - but I personally could never work them out :-) Maybe
there is some reasonable documentation or example code for doing that
these days - but there wasn't when I first approached the problem
(which was back in the python 2.1 days - ancient history!). Printing
using Windows API was a complete mystery to me.
My first GUI application required information to be printed out - I
wrote the whole thing using Pmw and Tkinter - only to find that I had
no way of getting stuff to a printer (I was learning Python and
Tkinter at the time :-)). I briefly explored "porting" my application
to wxPython or Jython because both frameworks provided printer API
functions - at that time, PyQT was commercial license only for a PC,
so that wasn't an option. I found wxPython stunningly hard to
understand from the documentation (I have since purchased wxPython in
Action by Rappin and Dunn but have never found the time to read it). I
had some problems porting the code to Jython (my code relied heavily
on the pickle module and Jython had some severe bugs in that area at
the time), so in the end I came up with a fairly micky-mouse system
that placed information that required printing into .txt files and the
GUI application started Microsoft Word using mail-merge templates and
I got the information to the printer that way - not ideal! But it
So consider that in your decision process - maybe somebody can
(kindly :-)) hop in here and say "that's easy, just look at xyz or
read this book abc" to find out how to print from within an
application using Tkinter.
More information about the Python-list