Skip to content
Prev 242256 / 398500 Next

Set colour in tcl variable

Immanuel -
    I don't believe you can associate a color with a TclVar,
but you can use tkconfigure to change the color of a label.
Does this little program help?

library(tcltk)
base = tktoplevel()
lab = tklabel(base,text='correct',foreground='green')
tkpack(lab)
red = function(...)tkconfigure(lab,foreground='red',text='wrong')
green = function(...)tkconfigure(lab,foreground='green',text='correct')
tkpack(tkbutton(base,text='Red',command=red))
tkpack(tkbutton(base,text='Green',command=green))


 					- Phil Spector
 					 Statistical Computing Facility
 					 Department of Statistics
 					 UC Berkeley
 					 spector at stat.berkeley.edu
On Fri, 19 Nov 2010, Immanuel Seeger wrote: