[Tkinter-discuss] [ANN] Ttk wrapper 0.0.9

Guilherme Polo ggpolo at gmail.com
Sun Jun 8 14:13:05 CEST 2008


2008/6/8 Gerard flanagan <grflanagan at gmail.com>:
> Guilherme Polo wrote:
>>
>> 2008/6/7 Guilherme Polo <ggpolo at gmail.com>:
>>>
>>> 2008/6/7 Gerard flanagan <grflanagan at gmail.com>:
>>>>
>>>> Guilherme Polo wrote:
>>>>>
>>>>> Hello,
>>>>>
>>>>> Over the last weeks I've been doing a ttk wrapper as part of my GSoC
>>>>> project and now I feel that I can announce it in hope some people
>>>>> start using it.
>>>>>
>>>>>
>>>>> What is Ttk ?
>>>>>
>>>>>  This wrapper provides classes to allow using the Tk themed widget
>>>>> set, which has been included in Tk 8.5 but can be used with earlier
>>>>> versions if you have Tile installed. Ttk is based on a revised and
>>>>> enhanced version of TIP #48 (http://tip.tcl.tk/48) specified style
>>>>> engine.
>>>>>
>>>> [...]
>>>>>
>>>>>  Also, there is a site with some info regarding this project at:
>>>>> http://gpolo.ath.cx:81/projects/ttk_to_tkinter/
>>>>>
>>>>>
>>>> just a suggestion - how about some screenshots?
>>>>
>>
>> I just created a new project at code.google.com to host it,
>> http://code.google.com/p/python-ttk/ or the direct link for some
>> screenshots: http://code.google.com/p/python-ttk/wiki/Screenshots
>>
>
> Looks good, thanks.
>
> But, a problem:
>
> The only experience I have with Tkinter is via easygui
>
> http://www.ferg.org/easygui
>
> (which has its limitations, but i've found it invaluable for creating simple
> 'wizard' style interfaces for various configuration tasks.)
>
> So, (on xubuntu Hardy) I did:
>
> apt-get tk-tile
> svn co http://svn.python.org/projects/sandbox/trunk/ttk-gsoc ttk-trunk
> updated PYTHONPATH
> no problem with `import ttk`
> as per the docs, edited easygui.py to include `from ttk import *`
> below the line `from Tkinter import *`
> but app fails immediately with the following traceback
>
>  File "lib/_h2hdeploygui.py", line 374, in main
>    choice = choicebox(MAIN_MSG, MAIN_MSG, MAIN.keys())
>  File "lib/itsalib/util/easygui.py", line 611, in choicebox
>    return __choicebox(message, title, choices)
>  File "lib/itsalib/util/easygui.py", line 745, in __choicebox
>    okButton = Button(buttonsFrame, takefocus=YES, text="OK", height=1,
> width=6)
>  File "/home/gerard/current/ttk-trunk/src/2.x/ttk.py", line 559, in __init__
>    Widget.__init__(self, master, "ttk::button", kw)
>  File "/home/gerard/current/ttk-trunk/src/2.x/ttk.py", line 505, in __init__
>    Tkinter.Widget.__init__(self, master, widgetname, kw=kw)
>  File "/usr/lib/python2.5/lib-tk/Tkinter.py", line 1933, in __init__
>    (widgetName, self._w) + extra + self._options(cnf))
> TclError: unknown option "-height"
>
> I noticed that there was a more recent easygui.py (73), but the same
> result - app works without the ttk import, doesn't work with.
>

Doing "from ttk import *" is not always a drop-in replacement for
Tkinter, you will usually have to adjust your app.

> Fixable?

In this case it was an easy fix, just commented out some parts. I'm
attaching the patch against easygui73, hope it works for you. This
patch is supposed to be applied at a clean, just unzipped, easygui.py
(version 73).

Regards,

-- 
-- Guilherme H. Polo Goncalves
-------------- next part --------------
A non-text attachment was scrubbed...
Name: easygui_ttk.diff
Type: text/x-diff
Size: 2381 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20080608/eec20199/attachment.diff>


More information about the Tkinter-discuss mailing list