[vtkusers] Fw: Message vtkUser

tom fogal tfogal at apollo.sr.unh.edu
Wed Dec 8 20:55:29 EST 2004


 <001701c4dd94$00b644e0$3a751d96 at surgsim2>"Michel Audette" writes:
>Hello VTKuser,
>
>I have some problems with management of many vtkTkRenderWidget.
>
>I am developing GUI for surgical software in Python Language.
>Each window of this GUI have one vtkTkRenderWidget to show 3D Objects
>(One of them used the vtksliceWidget develop by Atamai).
>I succeed to show one objects in one of these windows.
>But if I try to open another one I get this error:

I know someone who had a similar error. "Sometimes" opening another
vtkTkRenderWidget window in python (didn't try C++) would cause his
entire X server to crash. He tore his hair out over it for over a week.

A solution was never found. He reworked his app so that it didn't use
multiple Tk render windows, and the problem went away.

Daunting news, I know. Sorry. If you find a solution, the list (or at
the very least, me) would love to hear about it.

-tom

>File "/usr/local/lib/python2.2/lib-tk/Tkinter.py", line 1316, in __call__
>    return apply(self.func, args)
>  File "selection.py", line 64, in <lambda>
>    command = lambda:
>  File "functionclass.py", line 550, in entranceTriplan
>    self.show2(self.triplan)
>  File "functionclass.py", line 164, in show2
>    self.affichageTriplan("exemple.mnc")
>  File "functionclass.py", line 584, in affichageTriplan
>    self.viewer1 = vtkSliceWidget.vtkSliceWidget(self.triplan.frame1,
>width=256,height=256)
>  File "/home/athinnes/atamai/examples/vtkSliceWidget.py", line 108, in
>__init__
>    Tkinter.Widget.__init__(self, master, 'vtkTkRenderWidget', cnf, kw)
>  File "/usr/local/lib/python2.2/lib-tk/Tkinter.py", line 1780, in
>__init__
>    self.tk.call(
>TclError: invalid command name "vtkTkRenderWidget"
>
>This following is a simplify version of the software architecture without
>using vtkSliceWidget .
>Each module corresponding to one part of the interface:
>
>######################################################################
>#testfunc.py
>
>from Tkinter import *
>from vtkTkRenderWidget import *
>import triplantest
>import bouton
>import render
>
>class Functions:
>
>   def __init__(self, myParent):
>      print "functions class created"
># If you comment the self.render line. The button will open the
>triplantest window
>      self.render = render.Render(self, myParent)
>
>      self.bouton = bouton.Bouton(self)
>      self.triplan = triplantest.Triplan(self)
>
>## Procedure:  show
># this procedure is call to show on the screen the windows winname
>   def show(self, winname):
>      winname.deiconify()
>      self.affichageTriplan()
>
>## Procedure:  affichageTriplan
># This procedure setup the slice image inside triplan interface
>
>   def affichageTriplan(self):
>
>      self.renderWidget = vtkTkRenderWidget(self.triplan.frame1)
>      self.renderWidget.pack(expand='true',fill='both')
>
>
>if __name__ == '__main__':
>
>   root = Tk()
>   function = Functions(root)
>   function.triplan.withdraw()
>   root.mainloop()
>
>#######################################################################
>#render.py
>
>from vtkTkRenderWidget import *
>from vtkpython import *
>from Tkinter import *
>
>class Render:
>
>   def __init__(self, myFunctions, myParentFunction):
>
>      self.functions = myFunctions
>      myParentFunction.title("test vtkTkRenderWidget")
>
>      self.viewer = Frame(myParentFunction, borderwidth = 2, relief =
>"ridge")
>      self.renderWidget = vtkTkRenderWidget(self.viewer)
>
>      self.viewer.pack(expand='true',fill='both')
>      self.renderWidget.pack(expand='true',fill='both')
>
>#########################################################################
>#
>#triplantest.py
>
>from Tkinter import *
>
>class Triplan(Tk):
>   def __init__(self, myFct):
>      Tk.__init__(self)
>
>      self.functions = myFct
>      self.title("Frame for vtkSliceWidget")
>
>      self.mainframe = Frame(self)
>      self.frame1 = Frame(self.mainframe, relief="ridge", borderwidth=2)
>
>      self.frame1.pack(expand='true',fill='both')
>      self.mainframe.pack(expand='true',fill='both')
>
>###############################################################
>#bouton.py
>
>from Tkinter import *
>class Bouton(Tk):
>
>   def __init__(self, myFunctions):
>      Tk.__init__(self)
>      self.functions = myFunctions
>      self.title("Click On Button")
>      self.frame = Frame(self)
>      self.bouton = Button(self.frame, text = "click \nhere",
>       command = lambda:
>         self.functions.show(self.functions.triplan)
>      )
>
>      self.frame.pack(expand='true',fill='both')
>      self.bouton.pack(expand='true',fill='both')
>
>######################################################################3
>
>If you run "python testfunc.py" you will see the error. It's the same I
>have in the full software.
>
>Somebody have any idea why it's not working and how to solve it?
>It seams, vtkTkRenderWidget cannot be call twice. But I don't know how to
>solve it.
>
>Thank you for your attention
>Best regards
>Alexandre Thinnes
>
>
>Je dois avoir un probleme de mail avec l'AIST.
>Il semble que l'adresse qui envois les mails ne soit pas celle qui les
>recois. >_<
>
>Accédez au courrier électronique de La Poste : www.laposte.net ;
>3615 LAPOSTENET (0,34?/mn) ; tél : 08 92 68 13 50 (0,34?/mn)
>
>
>
>_______________________________________________
>This is the private VTK discussion list. 
>Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_F
>AQ
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers



More information about the vtkusers mailing list