[vtkusers] broken vtkTkRenderWindowInteractor.py in 5.2.0?
Mathieu Malaterre
mathieu.malaterre at gmail.com
Tue Sep 2 09:30:00 EDT 2008
On Tue, Sep 2, 2008 at 3:27 PM, Mathieu Malaterre
<mathieu.malaterre at gmail.com> wrote:
> Alex,
>
> On Tue, Sep 2, 2008 at 4:04 AM, Alexander Pletzer <pletzer at txcorp.com> wrote:
>> Hi,
>>
>> I have downloaded and built vtk a few weeks ago from cvs. I'm encountering
>> an error I never had before, which can also be reproduced by running
>> vtkTkRenderWindowInteractor.py in standalone, ie running the
>> vtkRenderWindowInteractorConeExample() example:
>>
>> [pletzer at localhost tmp]$ python
>> /usr/lib/python2.5/site-packages/VTK-5.2.0-py2.5.egg/vtk/tk/vtkTkRenderWindowInteractor.py
>> Traceback (most recent call last):
>> File
>> "/usr/lib/python2.5/site-packages/VTK-5.2.0-py2.5.egg/vtk/tk/vtkTkRenderWindowInteractor.py",
>> line 394, in <module>
>> vtkRenderWindowInteractorConeExample()
>> File
>> "/usr/lib/python2.5/site-packages/VTK-5.2.0-py2.5.egg/vtk/tk/vtkTkRenderWindowInteractor.py",
>> line 364, in vtkRenderWindowInteractorConeExample
>> pane = vtkTkRenderWindowInteractor(root, width=300, height=300)
>> File
>> "/usr/lib/python2.5/site-packages/VTK-5.2.0-py2.5.egg/vtk/tk/vtkTkRenderWindowInteractor.py",
>> line 48, in __init__
>> vtkLoadPythonTkWidgets(master.tk)
>> File
>> "/usr/lib/python2.5/site-packages/VTK-5.2.0-py2.5.egg/vtk/tk/vtkLoadPythonTkWidgets.py",
>> line 54, in vtkLoadPythonTkWidgets
>> if len(path) > 0 and path[0] == '{' and path[-1] == '}':
>> TypeError: object of type '_tkinter.Tcl_Obj' has no len()
>>
>>
>>>>> v = vtk.vtkVersion()
>>>>> print v.GetVTKVersion()
>> 5.2.0
>>
>>
>> Any suggestion would be welcome. Thanks for your help.
>
> That has nothing to do with VTK AFAIK. Could you try something like:
>
>
> $ python
>>>> s = "bla"
>>>> len(s)
>
> len is supposed to be a build in function of python. Or maybe you are
> using Python 3.0 and they seriously broke backward compatibility ;)
>
Spoke too soon, this is a well known issue at least documented on
python.org pages:
http://www.python.org/doc/2.3/whatsnew/node18.html
...
Calling Tcl methods through _tkinter no longer returns only strings.
Instead, if Tcl returns other objects those objects are converted to
their Python equivalent, if one exists, or wrapped with a
_tkinter.Tcl_Obj object if no Python equivalent exists. This behavior
can be controlled through the wantobjects() method of tkapp objects.
When using _tkinter through the Tkinter module (as most Tkinter
applications will), this feature is always activated. It should not
cause compatibility problems, since Tkinter would always convert
string results to Python types where possible.
If any incompatibilities are found, the old behavior can be restored
by setting the wantobjects variable in the Tkinter module to false
before creating the first tkapp object.
import Tkinter
Tkinter.wantobjects = 0
Any breakage caused by this change should be reported as a bug.
...
--
Mathieu
More information about the vtkusers
mailing list