tkinter, option_add, entry field trouble

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bob Greschke

    tkinter, option_add, entry field trouble

    I can't get

    Root.option_add ("*Entry*highli ghtthickness", "2")
    Root.option_add ("*Entry*highli ghtcolor", "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


  • jepler@unpythonic.net

    #2
    Re: tkinter, option_add, entry field trouble

    I think you have to spell it
    Root.option_add ("*Entry*highli ghtThickness", "2")
    Root.option_add ("*Entry*highli ghtColor", "green")

    When you're not sure of the capitalization, do something like this
    interactively:[color=blue][color=green][color=darkred]
    >>> e.configure('hi ghlightcolor')[/color][/color][/color]
    ('highlightcolo r', 'highlightColor ', 'HighlightColor ',
    'SystemWindowFr ame', '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)

    iD8DBQFCo07lJd0 1MZaTXX0RApGcAJ 9x14jVcVIm0s5pa uuDa04+8Ar9lwCg gB8A
    xJSS/LiJmxe5UPiElGWW gbQ=
    =UEqi
    -----END PGP SIGNATURE-----

    Comment

    • Bob Greschke

      #3
      Re: tkinter, option_add, entry field trouble

      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!

      <jepler@unpytho nic.net> wrote in message
      news:mailman.12 .1117998826.105 12.python-list@python.org ...

      I think you have to spell it
      Root.option_add ("*Entry*highli ghtThickness", "2")
      Root.option_add ("*Entry*highli ghtColor", "green")

      When you're not sure of the capitalization, do something like this
      interactively:[color=blue][color=green][color=darkred]
      >>> e.configure('hi ghlightcolor')[/color][/color][/color]
      ('highlightcolo r', 'highlightColor ', 'HighlightColor ',
      'SystemWindowFr ame', '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


      Comment

      Working...