2008/6/8 Gerard flanagan <[EMAIL PROTECTED]>: > Guilherme Polo wrote: >> >> 2008/6/7 Guilherme Polo <[EMAIL PROTECTED]>: >>> >>> 2008/6/7 Gerard flanagan <[EMAIL PROTECTED]>: >>>> >>>> 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
--- easygui.py 2008-02-10 23:48:12.000000000 -0200 +++ easygui.py.mine 2008-06-08 09:09:52.000000000 -0300 @@ -48,6 +48,7 @@ import sys from Tkinter import * +from ttk import * if TkVersion < 8.0 : print "\n" * 3 print "*"*75 @@ -780,7 +781,7 @@ # put the buttons in the buttonsFrame if len(choices) > 0: - okButton = Button(buttonsFrame, takefocus=YES, text="OK", height=1, width=6) + okButton = Button(buttonsFrame, takefocus=YES, text="OK") okButton.pack(expand=NO, side=TOP, padx='2m', pady='1m', ipady="1m", ipadx="2m") okButton.bind("<Return>", __choiceboxGetChoice) okButton.bind("<Button-1>",__choiceboxGetChoice) @@ -793,7 +794,7 @@ choiceboxWidget.bind("<Return>", __choiceboxCancel) choiceboxWidget.bind("<Double-Button-1>", __choiceboxCancel) - cancelButton = Button(buttonsFrame, takefocus=YES, text="Cancel", height=1, width=6) + cancelButton = Button(buttonsFrame, takefocus=YES, text="Cancel") cancelButton.pack(expand=NO, side=BOTTOM, padx='2m', pady='1m', ipady="1m", ipadx="2m") cancelButton.bind("<Return>", __choiceboxCancel) cancelButton.bind("<Button-1>", __choiceboxCancel) @@ -803,11 +804,11 @@ selectionButtonsFrame = Frame(messageFrame) selectionButtonsFrame.pack(side=RIGHT, fill=Y, expand=NO) - selectAllButton = Button(selectionButtonsFrame, text="Select All", height=1, width=6) + selectAllButton = Button(selectionButtonsFrame, text="Select All") selectAllButton.bind("<Button-1>",__choiceboxSelectAll) selectAllButton.pack(expand=NO, side=TOP, padx='2m', pady='1m', ipady="1m", ipadx="2m") - clearAllButton = Button(selectionButtonsFrame, text="Clear All", height=1, width=6) + clearAllButton = Button(selectionButtonsFrame, text="Clear All") clearAllButton.bind("<Button-1>",__choiceboxClearAll) clearAllButton.pack(expand=NO, side=TOP, padx='2m', pady='1m', ipady="1m", ipadx="2m") @@ -1041,7 +1042,7 @@ messageWidget.pack(side=LEFT, expand=YES, fill=BOTH, padx='1m', pady='1m') # put the buttons in the buttonsFrame - okButton = Button(buttonsFrame, takefocus=YES, text="OK", height=1, width=6) + okButton = Button(buttonsFrame, takefocus=YES, text="OK") okButton.pack(expand=NO, side=TOP, padx='2m', pady='1m', ipady="1m", ipadx="2m") okButton.bind("<Return>" , __textboxOK) okButton.bind("<Button-1>", __textboxOK)
_______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss