Tkinter Radiobutton and askfloat()
Eric Brunel
eric.brunel at pragmadev.com
Tue May 20 04:11:36 EDT 2003
Jon Hsieh wrote:
> Hi,
> I created a Radiobutton:
>
>> from Tkinter import *
>> from tkSimpleDialog import askfloat
>>
>> def callme():
>> num = askfloat("askfloat", "float:")
>>
>> root = Tk()
>> rb = Radiobutton(root, command=callme)
>
> > rb.pack()
> > root.mainloop()
>
> When this code is run, I get the following exception:
>
>> File "/usr/lib/python2.2/lib-tk/tkSimpleDialog.py", line 271, in
>> askfloat
>> d = apply(_QueryFloat, (title, prompt), kw)
>> File "/usr/lib/python2.2/lib-tk/tkSimpleDialog.py", line 179, in
>> __init__
>> Dialog.__init__(self, parent, title)
>> File "/usr/lib/python2.2/lib-tk/tkSimpleDialog.py", line 64, in
>> __init__
>> self.grab_set()
>> File "/usr/lib/python2.2/lib-tk/Tkinter.py", line 493, in grab_set
>> self.tk.call('grab', 'set', self._w)
>> TclError: grab failed: window not viewable
Same problem here (Python 2.1 on Mandrake 8.0). I don't know the exact status of
the module tkSimpleDialog; is it still supported?
BTW, I'd use Pmw's PromptDialog for this kind of stuff. It's far more powerful
than all dialogs in tkSimpleDialog. And if you're into Tkinter, you soon won't
be able to live without Pmw ;-)
http://pmw.sourceforge.net/
HTH
--
- Eric Brunel <eric.brunel at pragmadev.com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com
More information about the Python-list
mailing list