From: Jeff Godfrey on
On 6/23/2010 4:06 PM, wm7506(a)yahoo.com wrote:
> 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!!

Hi Bill,

Unless I missed it, you didn't mention what OS you're working with. In
this case, that's important as some OS's (Windows for example) use
native dialogs and some use Tcl/Tk based dialogs (*nix for example).

For native dialogs, you can't change the color of the text (at least
that I'm aware of) - especially the color of just a portion of the text.
For the Tcl/Tk based dialogs, I'm not too sure (as I don't use them)
if this is supported or not. However, since it's just Tcl/Tk code, if
it's not supported, you can always change it as needed.

Also, for those OS's that use native dialogs, you should be able to
specifically request the Tcl/Tk version instead, in which case you could
again change the dialog source as needed.

Beyond that, if you're just talking about a basic message box, you could
always just roll your own from scratch, and add whatever behavior you
want. There are probably lots of references on the wiki.

http://wiki.tcl.tk

Jeff