Hello everyone,
my student had the following problem with a python program featuring
multiple vtkTkRenderWidg et calls. See below...
Can anyone suggest a workaround?
Best regards,
Michel
Michel Audette, Ph.D.,
Research Fellow, Surgical Simulation,
Surgical Assist Technology Group,
AIST,
Namiki 1-2,
Tsukuba, Japan,
305-8564.
--------------------------------------------------------
"If you think you can do it, you're right.
If you think you can't do it, you're still right."
- Henry Ford
[color=blue]
>
> I have some problems with management of many vtkTkRenderWidg et.
>
> I am developing GUI for surgical software in Python Language.
> Each window of this GUI have one vtkTkRenderWidg et 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:
>
> 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.affichageT riplan("exemple .mnc")
> File "functionclass. py", line 584, in affichageTripla n
> self.viewer1 = vtkSliceWidget. vtkSliceWidget( self.triplan.fr ame1,
> width=256,heigh t=256)
> File "/home/athinnes/atamai/examples/vtkSliceWidget. py", line 108, in
> __init__
> Tkinter.Widget. __init__(self, master, 'vtkTkRenderWid get', cnf, kw)
> File "/usr/local/lib/python2.2/lib-tk/Tkinter.py", line 1780, in
> __init__
> self.tk.call(
> TclError: invalid command name "vtkTkRenderWid get"
>
> 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 vtkTkRenderWidg et 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(s elf, myParent)
>
> self.bouton = bouton.Bouton(s elf)
> self.triplan = triplantest.Tri plan(self)
>
> ## Procedure: show
> # this procedure is call to show on the screen the windows winname
> def show(self, winname):
> winname.deiconi fy()
> self.affichageT riplan()
>
> ## Procedure: affichageTripla n
> # This procedure setup the slice image inside triplan interface
>
> def affichageTripla n(self):
>
> self.renderWidg et = vtkTkRenderWidg et(self.triplan .frame1)
> self.renderWidg et.pack(expand= 'true',fill='bo th')
>
>
> if __name__ == '__main__':
>
> root = Tk()
> function = Functions(root)
> function.tripla n.withdraw()
> root.mainloop()
>
> ############### ############### ############### ############### ###########
> #render.py
>
> from vtkTkRenderWidg et import *
> from vtkpython import *
> from Tkinter import *
>
> class Render:
>
> def __init__(self, myFunctions, myParentFunctio n):
>
> self.functions = myFunctions
> myParentFunctio n.title("test vtkTkRenderWidg et")
>
> self.viewer = Frame(myParentF unction, borderwidth = 2, relief =
> "ridge")
> self.renderWidg et = vtkTkRenderWidg et(self.viewer)
>
> self.viewer.pac k(expand='true' ,fill='both')
> self.renderWidg et.pack(expand= 'true',fill='bo th')
>
> ############### ############### ############### ############### #############
> #
> #triplantest.py
>
> from Tkinter import *
>
> class Triplan(Tk):
> def __init__(self, myFct):
> Tk.__init__(sel f)
>
> self.functions = myFct
> self.title("Fra me for vtkSliceWidget" )
>
> self.mainframe = Frame(self)
> self.frame1 = Frame(self.main frame, relief="ridge", borderwidth=2)
>
> self.frame1.pac k(expand='true' ,fill='both')
> self.mainframe. pack(expand='tr ue',fill='both' )
>
> ############### ############### ############### ############### ###
> #bouton.py
>
> from Tkinter import *
> class Bouton(Tk):
>
> def __init__(self, myFunctions):
> Tk.__init__(sel f)
> self.functions = myFunctions
> self.title("Cli ck On Button")
> self.frame = Frame(self)
> self.bouton = Button(self.fra me, text = "click \nhere",
> command = lambda:
> self.functions. show(self.funct ions.triplan)
> )
>
> self.frame.pack (expand='true', fill='both')
> self.bouton.pac k(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, vtkTkRenderWidg et 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)
>
>
>[/color]
my student had the following problem with a python program featuring
multiple vtkTkRenderWidg et calls. See below...
Can anyone suggest a workaround?
Best regards,
Michel
Michel Audette, Ph.D.,
Research Fellow, Surgical Simulation,
Surgical Assist Technology Group,
AIST,
Namiki 1-2,
Tsukuba, Japan,
305-8564.
--------------------------------------------------------
"If you think you can do it, you're right.
If you think you can't do it, you're still right."
- Henry Ford
[color=blue]
>
> I have some problems with management of many vtkTkRenderWidg et.
>
> I am developing GUI for surgical software in Python Language.
> Each window of this GUI have one vtkTkRenderWidg et 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:
>
> 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.affichageT riplan("exemple .mnc")
> File "functionclass. py", line 584, in affichageTripla n
> self.viewer1 = vtkSliceWidget. vtkSliceWidget( self.triplan.fr ame1,
> width=256,heigh t=256)
> File "/home/athinnes/atamai/examples/vtkSliceWidget. py", line 108, in
> __init__
> Tkinter.Widget. __init__(self, master, 'vtkTkRenderWid get', cnf, kw)
> File "/usr/local/lib/python2.2/lib-tk/Tkinter.py", line 1780, in
> __init__
> self.tk.call(
> TclError: invalid command name "vtkTkRenderWid get"
>
> 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 vtkTkRenderWidg et 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(s elf, myParent)
>
> self.bouton = bouton.Bouton(s elf)
> self.triplan = triplantest.Tri plan(self)
>
> ## Procedure: show
> # this procedure is call to show on the screen the windows winname
> def show(self, winname):
> winname.deiconi fy()
> self.affichageT riplan()
>
> ## Procedure: affichageTripla n
> # This procedure setup the slice image inside triplan interface
>
> def affichageTripla n(self):
>
> self.renderWidg et = vtkTkRenderWidg et(self.triplan .frame1)
> self.renderWidg et.pack(expand= 'true',fill='bo th')
>
>
> if __name__ == '__main__':
>
> root = Tk()
> function = Functions(root)
> function.tripla n.withdraw()
> root.mainloop()
>
> ############### ############### ############### ############### ###########
> #render.py
>
> from vtkTkRenderWidg et import *
> from vtkpython import *
> from Tkinter import *
>
> class Render:
>
> def __init__(self, myFunctions, myParentFunctio n):
>
> self.functions = myFunctions
> myParentFunctio n.title("test vtkTkRenderWidg et")
>
> self.viewer = Frame(myParentF unction, borderwidth = 2, relief =
> "ridge")
> self.renderWidg et = vtkTkRenderWidg et(self.viewer)
>
> self.viewer.pac k(expand='true' ,fill='both')
> self.renderWidg et.pack(expand= 'true',fill='bo th')
>
> ############### ############### ############### ############### #############
> #
> #triplantest.py
>
> from Tkinter import *
>
> class Triplan(Tk):
> def __init__(self, myFct):
> Tk.__init__(sel f)
>
> self.functions = myFct
> self.title("Fra me for vtkSliceWidget" )
>
> self.mainframe = Frame(self)
> self.frame1 = Frame(self.main frame, relief="ridge", borderwidth=2)
>
> self.frame1.pac k(expand='true' ,fill='both')
> self.mainframe. pack(expand='tr ue',fill='both' )
>
> ############### ############### ############### ############### ###
> #bouton.py
>
> from Tkinter import *
> class Bouton(Tk):
>
> def __init__(self, myFunctions):
> Tk.__init__(sel f)
> self.functions = myFunctions
> self.title("Cli ck On Button")
> self.frame = Frame(self)
> self.bouton = Button(self.fra me, text = "click \nhere",
> command = lambda:
> self.functions. show(self.funct ions.triplan)
> )
>
> self.frame.pack (expand='true', fill='both')
> self.bouton.pac k(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, vtkTkRenderWidg et 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)
>
>
>[/color]