tkinter, option_add, entry field trouble

B

Bob Greschke

I can't get

Root.option_add("*Entry*highlightthickness", "2")
Root.option_add("*Entry*highlightcolor", "green")

to work. Anyone know why? Setting the font, background color, etc.
this way works OK.

Are there some options that can't be set "globally"? Setting these two
options in the Entry() statements themselves works OK. I've just got
about 200 Entry statements that I was hoping to not have to edit. :)

This is on Linux FC1, Python 2.3.

Thanks!

Bob
 
J

jepler

I think you have to spell it
Root.option_add("*Entry*highlightThickness", "2")
Root.option_add("*Entry*highlightColor", "green")

When you're not sure of the capitalization, do something like this
interactively:
>>> e.configure('highlightcolor')
('highlightcolor', 'highlightColor', 'HighlightColor',
'SystemWindowFrame', 'green')
When you use 'configure' this way, the *second* string has the correct
capitalization for use in option_add. The fourth is the system default before
taking into account the option database, and the last is the current value.

Jeff

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFCo07lJd01MZaTXX0RApGcAJ9x14jVcVIm0s5pauuDa04+8Ar9lwCggB8A
xJSS/LiJmxe5UPiElGWWgbQ=
=UEqi
-----END PGP SIGNATURE-----
 
B

Bob Greschke

Yahoo! That was it. When is Grayson coming out with a new version of
"Python and Tkinter Programming"? Mine is getting pretty full of pen & ink
changes. :)

Nice tip, too!

Thanks!


I think you have to spell it
Root.option_add("*Entry*highlightThickness", "2")
Root.option_add("*Entry*highlightColor", "green")

When you're not sure of the capitalization, do something like this
interactively: ('highlightcolor', 'highlightColor', 'HighlightColor',
'SystemWindowFrame', 'green')
When you use 'configure' this way, the *second* string has the correct
capitalization for use in option_add. The fourth is the system default
before
taking into account the option database, and the last is the current value.

Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,188
Latest member
Crypto TaxSoftware

Latest Threads

Top