How to close the main VTK window in code?

Tom G. Smith smitty at kcc.com
Mon Dec 27 08:29:03 EST 1999


I don't have a complete answer, but this may help.  I have a Tcl script
that converts ply-format files to VRML and VTK(PolyData) format.
I don't need the RenderWindow to show on my display at all, so I do
a Tk destroy.  Something similar might work for you.  Here's part of
the code:


...lines omitted...
proc cmd {cmds} {
# ---------------------------------------------------------------
# Called to run a list of vtk commands.
# ---------------------------------------------------------------
	global Debug
	foreach cmd $cmds {
		if {$Debug} { puts stderr $cmd; }
		eval $cmd
	}
} ;# End cmd.
...lines omitted...
cmd [list\
	"vtkActor objActor"\
	"objActor SetMapper objMapper"\
	"vtkRenderer ren1"\
	"renWin AddRenderer ren1"\
	"ren1 AddActor objActor"\
	"ren1 SetBackground 1 1 1"\
	"renWin SetSize 600 600"]
if {0 != [string length $v]} {
	# v-switch indicates creating a vrml dataset.
	cmd [list\
		"wm withdraw ."\
		"vtkVRMLExporter exp"\
		"exp SetRenderWindow renWin"\
		"exp SetFileName $v"\
		"exp Write"\
		"destroy ."]
} elseif {0 != [string length $p]} {
	# p-switch indicates creating a vtk PolyData object dataset.
	cmd [list\
		"wm withdraw ."\
		"vtkPolyDataWriter wtr"\
		"wtr SetInput obj"\
		"wtr SetFileName $p"\
		"wtr Update"\
		"destroy ."]
} else {
	# Otherwise define renderer, and invoke the interactor.
	cmd [list\
		"source /opt/vtk/examplesTcl/vtkInt.tcl"\
		"vtkRenderWindowInteractor iren"\
		"iren SetRenderWindow renWin"\
		"iren SetUserMethod {wm deiconify .vtkInteract}"\
		"iren Initialize"\
		"wm withdraw ."]
}

> 
> This is a multi-part message in MIME format.
> 
> ------=_NextPart_000_001E_01BF4E1F.745D7DA0
> Content-Type: text/plain; 
>  charset=gb2312
> Content-Transfer-Encoding: quoted-printable
> 
> Hi,all,
>    I want to control the main VTK window in my code process such as
> vtkRenderWindow->Close() in vc++6.0,but I didn't found it in VTK
> library.
>    In my program,I build the main VTK window by click a button,and I
> want to do other process after I close this window.But,if I click the
> button of close in the main VTK window,all programs will be closed.So I
> want to build or close the main VTK window by click a button in my
> control window(such as dialog of vc++6.0)
>    Could you tell me how to do?
> thanks!
> Merry Christmas
> csyang
> 
> ------=_NextPart_000_001E_01BF4E1F.745D7DA0
> Content-Type: text/html; 
>  charset=gb2312
> Content-Transfer-Encoding: quoted-printable
> 
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
> <HTML><HEAD>
> 
> <STYLE></STYLE>
> 
> <META content=3D'"MSHTML 5.00.0910.1309"' name=3DGENERATOR></HEAD>
> <BODY bgColor=3D#ffffff>
> <DIV><FONT size=3D2>Hi,all,</FONT></DIV>
> <DIV><FONT size=3D2>   I want to control the main VTK =
> window in my=20
> code process such as vtkRenderWindow->Close() in vc++6.0,but I=20
> didn't found it in VTK library.</FONT></DIV>
> <DIV><FONT size=3D2>   In my program,I build the main VTK =
> window by=20
> click a button,and I want to  do other process after I close this =
> window.But,if=20
> I click the button of close in the main VTK window,all programs will be =
> 
> closed.So I want to build or close the main VTK window by click a =
> button in my=20
> control window(such as dialog of vc++6.0)</FONT></DIV>
> <DIV><FONT size=3D2>   Could you tell me how to =
> do?</FONT></DIV>
> <DIV><FONT size=3D2>thanks!</FONT></DIV>
> <DIV><FONT size=3D2>Merry Christmas</FONT></DIV>
> <DIV><FONT size=3D2>csyang</FONT></DIV></BODY></HTML>
> 
> ------=_NextPart_000_001E_01BF4E1F.745D7DA0--
> 


-- 


-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------




More information about the vtkusers mailing list