"A First (Real) Example" code not working

227 views
Skip to first unread message

Jason Veldicott

unread,
Jan 11, 2012, 9:38:32 PM1/11/12
to tkd...@googlegroups.com
Hi,

I'm trying to run the code in "A First (Real) Example", with Tk version 8.5, and python 2.6.6, and get the following error msg:

Traceback (most recent call last):
  File "C:\Users\Jaz\Desktop\voice\tk_experiments\firstexample.py", line 14, in <module>
    mainframe = Frame(root, padding="3 3 12 12")
  File "C:\Python26\Lib\lib-tk\Tkinter.py", line 2444, in __init__
    Widget.__init__(self, master, 'frame', cnf, {}, extra)
  File "C:\Python26\Lib\lib-tk\Tkinter.py", line 1932, in __init__
    (widgetName, self._w) + extra + self._options(cnf))
TclError: unknown option "-padding"

I also have the latest version of tcl installed, but it's in c:\tcl and not sure at this point if it's actually being used.

I'm using Python 2.6.6 for compatibility with some other components.

Any suggestions as to why this error is occurring would be appreciated.

Thanks

Jason

Mark Roseman

unread,
Jan 11, 2012, 10:21:46 PM1/11/12
to tkd...@googlegroups.com, Jason Veldicott
Hi Jason,

The tutorial is assuming Python 3.x.  It is possible to get away with using Python 2.x with a few changes. However, it does rely on the 'themed Tk widgets' (ttk), rather than the standard/classic Tk widgets.  While there are similarities between them when it comes to API, they are not drop-in replacements for each other.  In this case, while the themed frame (ttk.Frame) supports a -padding option, the classic frame does not. 

Hope this helps.
Mark



--
You received this message because you are subscribed to the Google Groups "Tk Documentation and Resources" group.
To view this discussion on the web visit https://groups.google.com/d/msg/tkdocs/-/vIZhl1uuGiQJ.
To post to this group, send email to tkd...@googlegroups.com.
To unsubscribe from this group, send email to tkdocs+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/tkdocs?hl=en.

Jason Veldicott

unread,
Jan 11, 2012, 10:43:06 PM1/11/12
to tkd...@googlegroups.com, Jason Veldicott
Thanks for that Mark.  That explains the problem perfectly. Might for now press on with the tute removing offending bits, with option of resorting to adding a more recent installation of python if compatibility problems persist.

Jason
Reply all
Reply to author
Forward
0 new messages