[vtkusers] Multiple vtkTkRenderWidget in python

David Gobbi david.gobbi at gmail.com
Mon Apr 11 10:49:38 EDT 2016


Hi Aude,

What version of VTK are you using?

Can you try loading the vtkTkRederWidget binary model before opening the
file dialog? For example, something like this:

    import Tkinter
    from vtk.tk.vtkLoadPythonTkWidgets import vtkLoadPythonTkWidgets
    vtkLoadPythonTkWidgets(Tkinter.Tk())

 - David




On Mon, Apr 11, 2016 at 5:38 AM, CHENET Aude (External) <
Aude.CHENET-ext at galderma.com> wrote:

> Hi,
>
>
>
> I’m using vtk with python and try to do the following program :
>
> Choose a file using tkFileDialog (filepath =
> tkFileDialog.askopenfilename(title="Choisir une image",filetypes=[('tif
> files','.tif'),('tiff files','.tiff')]))
>
> Show the image in a window (render_widget =
> vtkTkRenderWindowInteractor(renderer_frame,
>
>                                                     rw=renWin, width=600,
>
>                                                     height=500))
>
>
>
> My program have the following error
>
> Traceback (most recent call last):
>
>   *File "C:\Users\chenet-ext\workspace\OCT\src\afficheComplet.py", line
> 328, in <module>*
>
>     V = Viewer(filepath)#("D:\resultatsOCT\Didier Cheek01 b_reconstr.tif”)
>
>   *File "C:\Users\chenet-ext\workspace\OCT\src\afficheComplet.py", line
> 165, in __init__*
>
>     height=500)
>
>   *File
> "C:\Python27\Lib\site-packages\vtk\tk\vtkTkRenderWindowInteractor.py", line
> 70, in __init__*
>
>     Tkinter.Widget.__init__(self, master, 'vtkTkRenderWidget', cnf, kw)
>
>   *File "C:\Python27\Lib\lib-tk\Tkinter.py", line 2090, in __init__*
>
>     (widgetName, self._w) + extra + self._options(cnf))
>
> _tkinter.TclError: invalid command name "vtkTkRenderWidget"
>
>
>
> The program runs normally if I don’t call tkFileDialog to choose the file.
> It seems like we can’t call tkFileDialog and then create a
> vtkTkRenderWindowInteractor
>
> Does anyone have an idea?
>
>
>
> Aude
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160411/bd5b5a2b/attachment.html>


More information about the vtkusers mailing list