Problems using tkSimpleDialog

Simon Brunning simon at brunningonline.net
Tue Dec 11 10:04:36 EST 2001


I an having trouble with this module. I'm running Python 2.1 on Win NT
4.

Here is what I am doing:

Python 2.1.1 (#20, Jul 20 2001, 01:19:29) [MSC 32 bit (Intel)] on
win32
Type "copyright", "credits" or "license" for more information.
>>> import tkSimpleDialog
>>> tkSimpleDialog.askstring('Title in here', 'Prompt here')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "D:\dev\python\lib\lib-tk\tkSimpleDialog.py", line 287, in
askstring
    d = apply(_QueryString, (title, prompt), kw)
  File "D:\dev\python\lib\lib-tk\tkSimpleDialog.py", line 177, in
__init__
    Dialog.__init__(self, parent, title)
  File "D:\dev\python\lib\lib-tk\tkSimpleDialog.py", line 71, in
__init__
    self.geometry("+%d+%d" % (parent.winfo_rootx()+50,
AttributeError: 'None' object has no attribute 'winfo_rootx'
>>>

Interestingly, I *do* see the required dialog here, along with an
empty window titled 'tk'. Entering anything into the dialog gets me:

Exception in Tkinter callback
Traceback (most recent call last):
  File "D:\dev\python\lib\lib-tk\Tkinter.py", line 1285, in __call__
    return apply(self.func, args)
  File "D:\dev\python\lib\lib-tk\tkSimpleDialog.py", line 127, in ok
    self.cancel()
  File "D:\dev\python\lib\lib-tk\tkSimpleDialog.py", line 132, in
cancel
    self.parent.focus_set()
AttributeError: 'None' object has no attribute 'focus_set'

What am I doing wrong?

Cheers,
Simon B.



More information about the Python-list mailing list