Ruby/Tk: How to specify default background colour

Discussion in 'Ruby' started by Ronald Fischer, Apr 21, 2006.

  1. I find the default colour assignment for Tk widgets (kind of a dark-green over a something I could best describe a muddy brown) a bit
    difficult to read, and therefore would like to use a different
    background colour for my widget.

    In my first attempt, I just assigned a new background colour to the
    TkRoot object, but this colour information is not inherited by the
    child widgets. Of course I can, for each child widget, explicitly
    configure the background colour, but I wonder whether there is
    maybe an easier way to do this.





    --
    Sent by mn-pg-p-e-b-consultant-3.com from siemens part from com
    This is a spam protected message. Please answer with reference header.
    Posted via http://www.usenet-replayer.com
     
    Ronald Fischer, Apr 21, 2006
    #1
    1. Advertising

  2. Ronald Fischer

    Ronny Guest

    Re: Ruby/Tk: How to specify default background colour (SOLVED)

    Ronald Fischer schrieb:

    > I find the default colour assignment for Tk widgets (kind of a dark-green over a something I could best describe a muddy brown) a bit
    > difficult to read, and therefore would like to use a different
    > background colour for my widget.


    I found the solution! Here is how I did it:

    Before entering the main loop, I use the statements

    $dft_background="#F8E8EE"
    TkOption.add("*foreground","blue")
    TkOption.add("*background",$dft_background)

    Then, when creating the root widget, I write

    TkRoot.new() { background $dft_background }

    This together has the desired effect.

    Ronald
     
    Ronny, Apr 26, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Doe

    Set the background colour of a grid

    John Doe, Oct 21, 2003, in forum: ASP .Net
    Replies:
    7
    Views:
    377
    Alvin Bruney
    Oct 22, 2003
  2. JezB
    Replies:
    9
    Views:
    372
    Curt_C [MVP]
    Apr 30, 2004
  3. Ali
    Replies:
    2
    Views:
    378
    Prateeksha Web Services
    Dec 23, 2003
  4. Dj Frenzy
    Replies:
    3
    Views:
    331
    Robert
    Feb 10, 2004
  5. jodleren
    Replies:
    2
    Views:
    212
    Thomas 'PointedEars' Lahn
    Jan 12, 2008
Loading...

Share This Page