Prev: ANN: DiffUtil
Next: How to change or set a string variable in Tcl/tk to a specificcolor to be displayed via tk_messageBox
From: wm7506 on 23 Jun 2010 17:06 Hi, Fairly new to Tcl so please excuse if silly question.... I have an entry widget that includes a -textvariable VMname that gets read in by the user's input. I then use tk_messageBox to output an error if a bad value is entered for VMname, including in the error message the value of VMname. My question, is there a way to change the color of this textvariable to perhaps red from within tk_messageBox -message $VMname ?? It looks like default is just black and no easy way to change color? Any ideas, suggestions, tips, or pointers to examples would be much appreciated!! proc get_virtual {} { set VMname "" destroy .lab .ent label .lab -text "Input your Virtual Machine Name:" # Create an entry widget, named .ent entry .ent -textvariable VMname focus .ent pack .lab pack .ent bind .ent <Return> { puts "the virtual machine name is: $VMname"; if {[catch {exec /opt/SUNWuttsc/bin/uttsc -m -b -A 16 -r sound:low $VMname} result] } { tk_messageBox -title " Error encountered!" -detail "Invalid Virtual Machine name:\n \"$VMname\"\n Please Re-Enter" -icon error - type ok return # error "$VMname: Invalid VM Name - Re-Input" } # set status [catch {exec /opt/SUNWuttsc/bin/uttsc -m -b -A 16 -r sound:low $VMname} result] set VMname "" destroy .lab .ent } } Thanks in advance, Bill bill.mutchie(a)oracle.com
From: Harald Oehlmann on 24 Jun 2010 04:54
On 23 Jun., 23:45, Jeff Godfrey <jeff_godf...(a)pobox.com> wrote: > > It looks like default is just black and no easy way > > to change color? Any ideas, suggestions, tips, or > > pointers to examples would be much appreciated!! Hi Bill, Jeffs answer is ok. Maybe, you would try the BWidget message box which is not native and has options like foreground, background etc. You may find it in tcllib on sourceforge or in ActiveTCL. Regards, Harald |