VMD-L Mailing List
From: Thomas Evangelidis (te8624_at_mbg.duth.gr)
Date: Sun Dec 21 2008 - 21:00:38 CST
- Next message: Peter Freddolino: "Re: Remove PBC"
- Previous message: Alessandro.Maiorana_at_roma2.infn.it: "Remove PBC"
- Next in thread: Peter Freddolino: "Re: difficulties referencing a variable within a namespace"
- Reply: Peter Freddolino: "Re: difficulties referencing a variable within a namespace"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Dear Tcl/Tk programmers,
I'm preparing a GUI to incorporate it into VMD in the context of a new
plugin. I
have a problem related to Object Oriented Tcl and particularly referencing
variable $w which points to the top level widget. The problem occurs when I
try to open a .psf file (see 2 last lines of code):
package provide tt_GUI 1.0
namespace eval ::tt_GUI:: {
namespace export startGUI
variable w
}
proc ::tt_GUI::startGUI {} {
variable w
# make the initial window
set w [toplevel ".tt_GUI"]
wm title $w "Truncate Trajcetory"
wm resizable $w 0 1
label $w.psfLab -text { Select trajcetory .psf file : }
label $w.psfPathLab -text {No file selected}
button $w.psfBut -command {set types {
{".psf Files" {.psf} }
}
set file [tk_getOpenFile -filetypes $types -parent .]
$w.psfPathLab configure -text $file} \
-text Open
....(irrelevant code)....
}
The error message I get is:
can't read "w": no such variable can't read "w": no such variable
while executing
"$w.psfPathLab configure -text $file"
invoked from within
".tt_GUI.psfBut invoke"
("uplevel" body line 1)
invoked from within
"uplevel #0 [ <http://wiki.tcl.tk/_edit/22154>list $w
invoke]<http://wiki.tcl.tk/_edit/22154>
"
(procedure "tk::ButtonUp" line 22)
invoked from within
"tk::ButtonUp .tt_GUI.psfBut "
(command bound to event)
That should be a piece of cake for a Tcl programmer but unfortunately I'm
not that familiar with OO Tcl. I would deeply appreciate any help.
Tom
----- End forwarded message -----
- Next message: Peter Freddolino: "Re: Remove PBC"
- Previous message: Alessandro.Maiorana_at_roma2.infn.it: "Remove PBC"
- Next in thread: Peter Freddolino: "Re: difficulties referencing a variable within a namespace"
- Reply: Peter Freddolino: "Re: difficulties referencing a variable within a namespace"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]