Python and Tkinter Programming by John Grayson

Discussion in 'Python' started by Ethan Furman, Jan 13, 2010.

  1. Ethan Furman

    Ethan Furman Guest

    Greetings!

    I am hoping to acquire a book on Python and Tkinter, and found this one.
    However, it was published in 2000 for Python 1.52...

    Can somebody who has this book comment its continued relevance? Is it
    still useful for Python 2.5 and Tk 8.4? Is it *very* useful?

    Comments appreciated!

    ~Ethan~
    Ethan Furman, Jan 13, 2010
    #1
    1. Advertising

  2. Ethan Furman

    Peter Guest

    On Jan 13, 11:19 am, Ethan Furman <> wrote:
    > Greetings!
    >
    > I am hoping to acquire a book on Python and Tkinter, and found this one.
    >   However, it was published in 2000 for Python 1.52...
    >
    > Can somebody who has this book comment its continued relevance?  Is it
    > still useful for Python 2.5 and Tk 8.4?  Is it *very* useful?
    >
    > Comments appreciated!
    >
    > ~Ethan~


    I have a copy - which I haven't read now for some years :)

    But it was an excellent introduction to using Python and Tkinter and
    depending on your level of experience, I would highly recommend it
    even now to anybody who is just beginning to use Python and Tkinter.
    In fact, I still loan it to any friends who are just starting out with
    Python and want to do their first GUI.

    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. The fact it was written back
    when Python was 1.52 is probably not relevant either as it isn't a
    book about learning Python (all such books quickly become 'dated'
    given the speed at which Python develops) but rather producing GUIs
    using Python and Tkinter - so it still does an excellent job for that
    even though I have abandoned the GUI application framework that John
    provides in his book (I used it once for my first GUI, but these days
    use Pmw more for my GUIs).

    Peter
    Peter, Jan 13, 2010
    #2
    1. Advertising

  3. Peter wrote:

    > provides in his book (I used it once for my first GUI, but these days
    > use Pmw more for my GUIs).
    >

    Maybe I'm wrong, but for me, it is THE Tkinter reference. I would probably
    choose another organization of the book, but I am not aware of a better,
    more complete treatise about. Even this year I did a small appplication and
    used it as reference.

    And it even has a PMW section!
    --
    Lord Eldritch
    Lord Eldritch, Jan 14, 2010
    #3
  4. Ethan Furman

    Mark Roseman Guest

    Peter <> 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 at
    http://www.tkdocs.com

    Mark
    Mark Roseman, Jan 14, 2010
    #4
  5. Ethan Furman

    Peter Guest

    On Jan 15, 6:24 am, Mark Roseman <> wrote:
    >  Peter <> 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.

    But I'll bow to your greater knowledge on the point on whether ttk
    themed widgets are a 'change' to Tkinter.

    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.

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

    Peter
    Peter, Jan 14, 2010
    #5
  6. Ethan Furman

    Kevin Walzer Guest

    On 1/14/10 3:39 PM, Peter wrote:
    > On Jan 15, 6:24 am, Mark Roseman<> wrote:
    >> Peter<> 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

    --
    Kevin Walzer
    Code by Kevin
    http://www.codebykevin.com
    Kevin Walzer, Jan 14, 2010
    #6
  7. Ethan Furman

    Peter Guest

    On Jan 15, 9:12 am, Kevin Walzer <> wrote:
    > On 1/14/10 3:39 PM, Peter wrote:
    >
    >
    >
    >
    >
    > > On Jan 15, 6:24 am, Mark Roseman<>  wrote:
    > >>   Peter<>  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
    >
    > --
    > 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
    worked :)

    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.

    Regards
    Peter
    Peter, Jan 21, 2010
    #7
  8. Ethan Furman

    Ethan Furman Guest

    Peter wrote:
    > On Jan 15, 9:12 am, Kevin Walzer <> wrote:
    >>> On Jan 15, 6:24 am, Mark Roseman<> wrote:
    >>>> Peter<> 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


    >> Another book I've found very helpful for learning Tkinter is Programming
    >> Python by Mark Lutz--a lot of coverage there of GUI development.
    >>

    >
    > Another possible consideration when choosing a GUI to learn Python -
    > will you want to print from within your GUI application?


    Excellent point.

    Many thanks to all who responded, especially for the reminder of the gui
    sections in Programming Python (forgot I had that book!). I'll start by
    going over that again, and we'll see how confident I feel afterwards. ;)

    ~Ethan~
    Ethan Furman, Jan 22, 2010
    #8
  9. Ethan Furman

    Pradeep B Guest

    On Fri, Jan 22, 2010 at 6:48 AM, Ethan Furman <> wrote:
    > Peter wrote:
    >>
    >> On Jan 15, 9:12 am, Kevin Walzer <> wrote:
    >>>>
    >>>> On Jan 15, 6:24 am, Mark Roseman<>  wrote:
    >>>>>
    >>>>>  Peter<>  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

    >
    >>> Another book I've found very helpful for learning Tkinter is Programming
    >>> Python by Mark Lutz--a lot of coverage there of GUI development.
    >>>

    >>
    >> Another possible consideration when choosing a GUI to learn Python -
    >> will you want to print from within your GUI application?

    >
    > Excellent point.
    >
    > Many thanks to all who responded, especially for the reminder of the gui
    > sections in Programming Python (forgot I had that book!).  I'll start by
    > going over that again, and we'll see how confident I feel afterwards.  ;)
    >
    > ~Ethan~
    > --
    > http://mail.python.org/mailman/listinfo/python-list
    >




    Is printing from GUI still a 'not-happening' thing with Tkinter ? I
    have just started learning it.



    --

    |_|0|_|
    |_|_|0|
    |0|0|0|

    http://picasaweb.google.com/pradeepbpin
    Pradeep B, May 29, 2010
    #9
  10. Ethan Furman

    Kevin Walzer Guest


    > Is printing from GUI still a 'not-happening' thing with Tkinter ? I
    > have just started learning it.


    Tkinter doesn't wrap native printing API's. There are a few extensions
    that do it, but they are platform specific and not complete.

    The usual ways of printing are like this:

    1. If you're outputting data from the text widget, write that to a
    temporary text file and print via lpr.

    2. If you're outputting data from the canvas, write that to a temporary
    postscript file and print via lpr.

    This is on Unix/MacOS. Not sure what the equivalent API on Windows is.

    --Kevin

    --
    Kevin Walzer
    Code by Kevin
    http://www.codebykevin.com
    Kevin Walzer, May 29, 2010
    #10
  11. Ethan Furman

    Pradeep B Guest

    On Sat, May 29, 2010 at 7:33 PM, Kevin Walzer <> wrote:

    > Tkinter doesn't wrap native printing API's. There are a few extensions that
    > do it, but they are platform specific and not complete.
    >
    > The usual ways of printing are like this:
    >
    > 1. If you're outputting data from the text widget, write that to a temporary
    > text file and print via lpr.
    >
    > 2. If you're outputting data from the canvas, write that to a temporary
    > postscript file and print via lpr.
    >
    > This is on Unix/MacOS. Not sure what the equivalent API on Windows is.
    >
    > --Kevin
    >
    > --
    > Kevin Walzer
    > Code by Kevin
    > http://www.codebykevin.com
    > --
    > http://mail.python.org/mailman/listinfo/python-list
    >



    Thanx Kevin.

    Anybody can throw light on how to do the same in Windows ?

    -pradeep


    --

    |_|0|_|
    |_|_|0|
    |0|0|0|

    http://picasaweb.google.com/pradeepbpin
    Pradeep B, May 31, 2010
    #11
  12. Pradeep B schrieb:

    >On Sat, May 29, 2010 at 7:33 PM, Kevin Walzer <> wrote:
    >
    >
    >
    >>Tkinter doesn't wrap native printing API's. There are a few extensions that
    >>do it, but they are platform specific and not complete.
    >>
    >>The usual ways of printing are like this:
    >>
    >>1. If you're outputting data from the text widget, write that to a temporary
    >>text file and print via lpr.
    >>
    >>2. If you're outputting data from the canvas, write that to a temporary
    >>postscript file and print via lpr.
    >>
    >>This is on Unix/MacOS. Not sure what the equivalent API on Windows is.
    >>
    >>--Kevin
    >>
    >>--
    >>Kevin Walzer
    >>Code by Kevin
    >>http://www.codebykevin.com
    >>--
    >>http://mail.python.org/mailman/listinfo/python-list
    >>
    >>
    >>

    >
    >
    >Thanx Kevin.
    >
    >Anybody can throw light on how to do the same in Windows ?
    >
    >-pradeep
    >
    >
    >
    >

    The conventional --crude-- way is to take the bitmap of a
    window and to stretchDIBBitBlt it onto the printer device in windows
    and osx. Native printer dialogs do exist for both platforms ...

    When you do not need a printer dialog:
    Convert the Tk-GUI to SVG, then wrap it into a fo-xml wrapper
    --fo accepts inline SVG-- and use fop for printing.
    This approach works cross-platform, albeit you need a Java
    intallation (fop is a Java application).

    You can use http://jeszra.sourceforge.net to generate SVG for a complete
    Tk-GUI.
    In addition. there is a python/tkinter SVG export project for the Tk canvas
    --search the tkinter wiki.


    -roger
    Arndt Roger Schneider, May 31, 2010
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. RN
    Replies:
    3
    Views:
    496
    Matt Berther
    Feb 27, 2005
  2. Ken Erickson
    Replies:
    0
    Views:
    366
    Ken Erickson
    Jul 13, 2003
  3. W. Watson

    Pmw Use and Grayson's Book

    W. Watson, Feb 18, 2008, in forum: Python
    Replies:
    4
    Views:
    257
    Mike Driscoll
    Feb 18, 2008
  4. W. eWatson

    Grayson, Tkinter, Chapter 5

    W. eWatson, Mar 28, 2009, in forum: Python
    Replies:
    0
    Views:
    287
    W. eWatson
    Mar 28, 2009
  5. Steven D'Aprano

    Re: Python and Tkinter by John E Grayson

    Steven D'Aprano, May 17, 2012, in forum: Python
    Replies:
    2
    Views:
    345
    Peter
    May 17, 2012
Loading...

Share This Page