[vtkusers] Question about tcl/tk-VTK application,..

Miguel Ángel Rodríguez Florido marf at itccanarias.org
Fri Sep 11 13:01:20 EDT 2009


	Hi all,

	Sorry, because this question is more related to tcl/tk, but I know that 
many people that works under VTK uses Tcl/Tk..so sorry again for people 
that not.

	My question is very simple, but I haven't found how to do that.

	I have a Tcl/Tk procedure like:

	proc myproc {vars} {
	
	code
	
	  foreach a $list {
		button .blabla.$a -text $a -command {puts $a}
	  }

	}


However the foreach variable $a doesn't exist in the -command option. I 
mean, I got an error when it runs this puts: puts $a.
	If I do global this variable: global a, I only got the last value of $a.

	So I understand that the foreach command is running first, and when it 
finishs, the tcl run the -command option of the tk button.

	How can I access to the variable "a" in the -command button option??. I 
mean, how can I get the value of "a" at foreach step in the -command option?

	Thank you very much.
	Best regards.

-- 
Miguel Ángel Rodríguez Florido
Departamento de Ingeniería Software
División de Investigación y Desarrollo Tecnológico
INSTITUTO TECNOLOGICO DE CANARIAS, S.A. - GOBIERNO DE CANARIAS
URL: www.itccanarias.org t: +34 928 727548/457462, f: +34 928 727517

--------------------------------------------------------------------------
AVISO LEGAL:
Este mensaje y los ficheros adjuntos si los hubiere, se dirigen 
exclusivamente a su destinatario y puede contener informaciÛn 
privilegiada o confidencial. La transmisiÛn errÛnea del presente mensaje 
en ning˙n momento supone renuncia a su confidencialidad. Si no es vd. el 
destinatario indicado, queda notificado de que la utilizaciÛn, 
divulgaciÛn y/o copia sin autorizaciÛn est· prohibida en virtud de la 
legislaciÛn vigente. Si ha recibido este mensaje por error, le rogamos 
que nos lo comunique inmediatamente por esta misma vÌa y proceda a su 
destrucciÛn.

LEGAL WARNING:
This message and the files attached if there were any, are intended 
exclusively for its addressee and may contain information that is 
CONFIDENTIAL and protected by professional privilege. A wrong 
transmission to this message don?t suppose we relinquished to It?s 
confidential. If you are not the intended recipient you are hereby 
notified that any dissemination, copy or disclosure of this 
communication is strictly prohibited by law. If this message has been 
received in error, please immediately notify us via e-mail and delete it.






More information about the vtkusers mailing list