#!/usr/local/bin/python """Demonstrate a bug in tkSimpleDialog.askFloat on MacOS X 10.3 with the standard built-in python 2.3 and Aqua Tk 8.4.9. Run this code. Push Set... to get the dialog box. Notice that: - The entry box is displayed over the prompt. - Clicking on the entry box has no effect. - Clicking below the entry box (i.e. where it OUGHT to be displayed) acts as though you clicked in the entry box. If you omit the initial value then the bug does not appear. Also: on one particular unix system, similar code caused the entire Tkinter application to become unresponsive once the dialog box was dismissed. However, the parent window for that dialog was not root and I did not specify the parent argument to askfloat, so that may explain the hang. I never saw any problems on a unix/X11 build of python 2.4 built against tcl/tk 8.4.6 on my MacOS X 10.3.7 box. """ import Tkinter import tkSimpleDialog class SecFocusWdg(Tkinter.Frame): def __init__ (self, master): Tkinter.Frame.__init__(self, master) btn = Tkinter.Button(self, text="Set...", command=self.doSet) btn.pack() def doSet(self): newFocus = tkSimpleDialog.askfloat( title = "Set Focus", prompt = "New secondary focus", initialvalue = 500, ) if newFocus == None: print "Cancel" else: print "OK", newFocus if __name__ == "__main__": root = Tkinter.Tk() testFrame = SecFocusWdg(root) testFrame.pack(anchor="nw") root.mainloop()