- #1
- 68,275
- 21,968
I'm improving an old Tcl/Tk test script of mine to be used in a simple test on the factory floor (previously I only used it in the R&D Lab for my own testing). With the current behaviour, I run the test and the Pass or Fail button changes from White to Green or Red, but I need to click the Pass or Fail button to reset the (background) color to White before running the test again. That's fine for my own work, but it will not be intuitive for the technicians on the factory floor.
I've been trying to get the Pass/Fail Buttons' background color to reset to White when re-running the test, but so far no joy. The code below runs, but the background color of the Pass/Fail Buttons does not change to White when re-running the test. Any thoughts? Or should I just change to some other display widget instead of using Buttons for the Pass/Fail indicators?
I'd expected this first part of the -command for "gobutton" to re-set the Pass/Fail Button colors to white:
-command { $passbutton configure -bg white; $failbutton configure -bg white;
Thanks!
I've been trying to get the Pass/Fail Buttons' background color to reset to White when re-running the test, but so far no joy. The code below runs, but the background color of the Pass/Fail Buttons does not change to White when re-running the test. Any thoughts? Or should I just change to some other display widget instead of using Buttons for the Pass/Fail indicators?
I'd expected this first part of the -command for "gobutton" to re-set the Pass/Fail Button colors to white:
-command { $passbutton configure -bg white; $failbutton configure -bg white;
Thanks!
Code:
# (initial comments omitted)
#
# Procedure to make sure we can find the UUT node
proc finduut {} {
source evbFirstTestConfig.tcl
exec nodeutil -d$LONx -INUiFind.txt -ONUoFind.txt
set filename "NUoFind.txt"
set pattern {Received an ID message}
set count 0
set fid [open $filename r]
while {[gets $fid line] != -1} {
incr count [regexp -all -- $pattern $line]
}
close $fid
if { $count == 0 } {return $count}
# Other test code goes here...
return $count
}
# Configure window size
. configure -width 375 -height 300
# Create Quit and Run buttons
set quitbutton [ button .quitbutton -text "EXIT" -command "exit" ]
set gobutton [ button .gobutton -text "Check Find UUT" \
-height 3 \
-command { $passbutton configure -bg white; $failbutton configure -bg white; \
if {[finduut] > 0} { $passbutton configure -bg green } \
else { $failbutton configure -bg red } } ]
# Create Pass and Fail buttons
set passbutton [ button .passbutton -bg white -text "PASS" \
-width 20 -height 10 \
-command { $passbutton configure -bg white } ]
set failbutton [ button .failbutton -bg white -text "FAIL" \
-width 20 -height 10 \
-command { $failbutton configure -bg white } ]
# Place Pass/Fail buttons near the top
place $passbutton -y 0 -x 0
place $failbutton -y 0 -x 200
# Place Go and Quit buttons near the bottom
place $gobutton -y 175 -x 125
place $quitbutton -y 250 -x 300
Attachments
Last edited: