[vtkusers] Multiple vtkTkRenderWidget in python

CHENET Aude (External) Aude.CHENET-ext at galderma.com
Mon Apr 11 10:57:39 EDT 2016


The version I use is 6.3.0.

I’ve tried what you’ve suggested, but didn’t work..

Aude

De : David Gobbi [mailto:david.gobbi at gmail.com]
Envoyé : lundi 11 avril 2016 16:50
À : CHENET Aude (External)
Cc : vtkusers at public.kitware.com
Objet : Re: [vtkusers] Multiple vtkTkRenderWidget in python

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<mailto: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/cc15d2c4/attachment.html>


More information about the vtkusers mailing list