<div dir="ltr">Hi Aude,<div><br></div><div>I suspect that, somehow, you end up with two separate tcl interpreters.</div><div>But I don't know how that would happen. Try something else for me:</div><div><br></div><div><div> import Tkinter</div><div> root = Tkinter.Tk()</div><div> from vtk.tk.vtkLoadPythonTkWidgets import vtkLoadPythonTkWidgets</div><div> vtkLoadPythonTkWidgets(root)</div></div><div> root.tk.call('vtkTkRenderWidget', '.vtkwidget')</div><div><br></div><div>If this prints '.vtkwidget' then you know that vtkTkRenderWidget exists.</div><div>If your program later says 'invalid command name "vtkTkRenderWidget"',</div><div>then that message must be coming from a different tcl interpreter.</div><div><br></div><div> - David</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 11, 2016 at 8:57 AM, CHENET Aude (External) <span dir="ltr"><<a href="mailto:Aude.CHENET-ext@galderma.com" target="_blank">Aude.CHENET-ext@galderma.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="FR" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">The version I use is 6.3.0.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I’ve tried what you’ve suggested, but didn’t work..<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Aude<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">De :</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> David Gobbi [mailto:<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>]
<br>
<b>Envoyé :</b> lundi 11 avril 2016 16:50<br>
<b>À :</b> CHENET Aude (External)<br>
<b>Cc :</b> <a href="mailto:vtkusers@public.kitware.com" target="_blank">vtkusers@public.kitware.com</a><br>
<b>Objet :</b> Re: [vtkusers] Multiple vtkTkRenderWidget in python<u></u><u></u></span></p><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">Hi Aude,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">What version of VTK are you using?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Can you try loading the vtkTkRederWidget binary model before opening the file dialog? For example, something like this:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"> import Tkinter<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> from vtk.tk.vtkLoadPythonTkWidgets import vtkLoadPythonTkWidgets<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> vtkLoadPythonTkWidgets(Tkinter.Tk())<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"> - David<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Mon, Apr 11, 2016 at 5:38 AM, CHENET Aude (External) <<a href="mailto:Aude.CHENET-ext@galderma.com" target="_blank">Aude.CHENET-ext@galderma.com</a>> wrote:<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">Hi,<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">I’m using vtk with python and try to do the following program :</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">Choose a file using tkFileDialog (filepath = tkFileDialog.askopenfilename(title="Choisir une image",filetypes=[('tif files','.tif'),('tiff files','.tiff')]))</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span lang="EN-US">Show the image in a window (render_widget</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black"> = vtkTkRenderWindowInteractor(renderer_frame,</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:black"> </span><span style="font-size:10.0pt;font-family:Consolas;color:black">rw=renWin, width=</span><span style="font-size:10.0pt;font-family:Consolas;color:maroon">600</span><span style="font-size:10.0pt;font-family:Consolas;color:black">,</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:black"> height=</span><span style="font-size:10.0pt;font-family:Consolas;color:maroon">500</span><span style="font-size:10.0pt;font-family:Consolas;color:black">))</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span lang="EN-US">My program have the following error </span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:red">Traceback (most recent call last):</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:red"> </span>
<u><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#0066cc">File "C:\Users\chenet-ext\workspace\OCT\src\afficheComplet.py", line 328, in <module></span></u><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:red"> V = Viewer(filepath)#("D:\resultatsOCT\Didier Cheek01 b_reconstr.tif”)</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:red"> </span>
<u><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#0066cc">File "C:\Users\chenet-ext\workspace\OCT\src\afficheComplet.py", line 165, in __init__</span></u><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:red"> height=500)</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:red"> </span>
<u><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#0066cc">File "C:\Python27\Lib\site-packages\vtk\tk\vtkTkRenderWindowInteractor.py", line 70, in __init__</span></u><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:red"> Tkinter.Widget.__init__(self, master, 'vtkTkRenderWidget', cnf, kw)</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:red"> </span>
<u><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#0066cc">File "C:\Python27\Lib\lib-tk\Tkinter.py", line 2090, in __init__</span></u><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:red"> (widgetName, self._w) + extra + self._options(cnf))</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:red">_tkinter.TclError: invalid command name "vtkTkRenderWidget"</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:red"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">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</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">Does anyone have an idea?</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#888888"> </span><span style="color:#888888"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#888888">Aude</span><span style="color:#888888"><u></u><u></u></span></p>
</div>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</div></div></div>
</div>
</blockquote></div><br></div>