[vtkusers] Destroy vtkRenderWindow before TkRenderWidget...?
Uwe Rempler
rempler at mechbau.uni-stuttgart.de
Mon Jan 19 03:47:53 EST 2004
hi list,
maybe it would be nice to add some sample code to clarify my problem
(read over the message i sent and noticed some possible
misunderstandings ;-)
do you see any other way for multiple render-sub-windows using tkinter()
or should i better switch to another gui-toolkit like qt/gtk+ or maybe
wxwindow?
cheers
uwe
#!/usr/bin/python
#------------------------------------- +
-------------------------------------
# Alpha:
# ======
alpha = '- ALPHA ' * 7 + '-'; print; print alpha; print '-' * len(alpha)
#------------------------------------- +
-------------------------------------
from Tkinter import *
from vtk import *
from vtk.tk.vtkTkRenderWindowInteractor import vtkTkRenderWindowInteractor
def main_quit():
print "quit mainwindow..."
mainwindow.quit()
def add_window():
global subwindow
subwindow = Toplevel()
subwindow.protocol("WM_DELETE_WINDOW", sub_quit)
subwindow.clientarea = Frame(subwindow, relief = RAISED, bd = 2)
subwindow.clientarea.pack(side = TOP, expand = YES, fill = BOTH)
subwindow.add_sub_quit_button = Button(subwindow, text = "Quit
subwindow",
command = sub_quit).pack(side = RIGHT)
subwindow.clientarea.renwin = vtkRenderWindow()
subwindow.clientarea.ren = vtkRenderer()
subwindow.clientarea.renwin.AddRenderer(subwindow.clientarea.ren)
subwindow.workspace = vtkTkRenderWindowInteractor(subwindow.clientarea,
rw = subwindow.clientarea.renwin, width = 400, height=400)
subwindow.workspace.Initialize()
subwindow.workspace.pack(side = TOP, expand = YES, fill = BOTH)
subwindow.clientarea.renwin.Render()
subwindow.workspace.Start()
#subwindow.mainloop()
print "subwindow added..."
def sub_quit():
print "quit subwindow..."
subwindow.destroy()
#subwindow.quit()
mainwindow = Tk()
mainwindow.protocol("WM_DELETE_WINDOW", main_quit)
mainwindow.add_window_button = Button(mainwindow, text = "Add window",
command = add_window).pack(side = LEFT)
mainwindow.add_main_quit_button = Button(mainwindow, text = "Quit
mainwindow",
command = main_quit).pack(side = RIGHT)
mainwindow.mainloop()
#------------------------------------- +
-------------------------------------
# Omega:
# ======
omega = '- OMEGA ' * 7 + '-'; print '-' * len(omega); print omega; print
#------------------------------------- +
-------------------------------------
More information about the vtkusers
mailing list