[vtkusers] Problems with Python and Tkinter

Gheorghe Postelnicu gheorghe.postelnicu at gmail.com
Thu Aug 31 18:03:16 EDT 2006


I am having lots of fun using VTK under Python. However, i noticed
there seems to be a problem when trying to invoke tkSimpleDialog
modules (such as the color picker), because of the requirement to do


in my application. Has anybody else encountered this problem? I am
using Python 2.3.4 under Linux.

To be more precise, since the main Tk window is withdrawn, the
tkSimpleDialog must be inheriting from the state of the main window. I
get the following error:

Traceback (most recent call last):
  File "pyScout.py", line 442, in SelectRegion
    spacing = tkSimpleDialog.askfloat("Profile spacing","Input spacing value")
  File "/usr/lib64/python2.3/lib-tk/tkSimpleDialog.py", line 271, in askfloat
    d = _QueryFloat(title, prompt, **kw)
  File "/usr/lib64/python2.3/lib-tk/tkSimpleDialog.py", line 179, in __init__
    Dialog.__init__(self, parent, title)
  File "/usr/lib64/python2.3/lib-tk/tkSimpleDialog.py", line 64, in __init__
  File "/usr/lib64/python2.3/lib-tk/Tkinter.py", line 521, in grab_set
    self.tk.call('grab', 'set', self._w)
_tkinter.TclError: grab failed: window not viewable

Gheorghe Postelnicu, PhD
MGH, Harvard Medical School

More information about the vtkusers mailing list