Tkinter color names/codes

Discussion in 'Python' started by Jeff Seale, Jan 19, 2004.

  1. Jeff Seale

    Jeff Seale Guest

    I just happend to notice that there are very FEW colors that you have to
    generate using #hex codes. But I was wondering, how many colors have names
    assigned to them in Tkinter and what are their #hex translations? It'd be
    nice to know these so I don't accidentally create a color that already has
    a name.
    Jeff Seale, Jan 19, 2004
    #1
    1. Advertising

  2. Jeff Seale

    Nuff Said Guest

    On Mon, 19 Jan 2004 20:39:18 +0000, Jeff Seale wrote:

    > I just happend to notice that there are very FEW colors that you have to
    > generate using #hex codes. But I was wondering, how many colors have names
    > assigned to them in Tkinter and what are their #hex translations? It'd be
    > nice to know these so I don't accidentally create a color that already has
    > a name.


    http://wiki.tcl.tk/8606
    - list with all named colors in Tcl/Tk

    http://wiki.tcl.tk/colors
    - W3C names, hex codes and Tcl/Tk names for the
    16 HTML 3.2 colors (i.e. the basic VGA set)

    HTH / Nuff
    Nuff Said, Jan 19, 2004
    #2
    1. Advertising

  3. Jeff Seale

    Jeff Seale Guest

    Nuff Said <> wrote in
    news:p:

    > On Mon, 19 Jan 2004 20:39:18 +0000, Jeff Seale wrote:
    >
    >> I just happend to notice that there are very FEW colors that you have
    >> to generate using #hex codes. But I was wondering, how many colors
    >> have names assigned to them in Tkinter and what are their #hex
    >> translations? It'd be nice to know these so I don't accidentally
    >> create a color that already has a name.

    >
    > http://wiki.tcl.tk/8606
    > - list with all named colors in Tcl/Tk
    >
    > http://wiki.tcl.tk/colors
    > - W3C names, hex codes and Tcl/Tk names for the
    > 16 HTML 3.2 colors (i.e. the basic VGA set)
    >
    > HTH / Nuff
    >


    Is it possible to translate all those colors into their #hex combinations?
    The ones I know about already are Red #FF0000, Yellow #FFFF00, Green #
    00FF00, Cyan #00FFFF, Blue #0000FF, Magenta #FF00FF, White #FFFFFF and
    Black #000000.
    Jeff Seale, Jan 23, 2004
    #3
  4. In article <Xns9478E236A5D3Fjseale18insightbbcom@204.127.204.17>,
    Jeff Seale <> wrote:
    >Nuff Said <> wrote in

    .
    .
    .
    >> http://wiki.tcl.tk/8606
    >> - list with all named colors in Tcl/Tk
    >>
    >> http://wiki.tcl.tk/colors
    >> - W3C names, hex codes and Tcl/Tk names for the
    >> 16 HTML 3.2 colors (i.e. the basic VGA set)
    >>
    >> HTH / Nuff
    >>

    >
    >Is it possible to translate all those colors into their #hex combinations?
    >The ones I know about already are Red #FF0000, Yellow #FFFF00, Green #
    >00FF00, Cyan #00FFFF, Blue #0000FF, Magenta #FF00FF, White #FFFFFF and
    >Black #000000.


    I'm not sure what you're asking. The references do just
    that, in several variations, although they're coded in
    Tcl/Tk, rather than Tkinter. Do you realize you can type
    $ python
    Python 2.2.1 (#1, Aug 30 2002, 12:15:30)
    [GCC 3.2 20020822 (Red Hat Linux Rawhide 3.2-4)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import Tkinter
    >>> l = Tkinter.Label()
    >>> l.winfo_rgb("red")

    (65535, 0, 0)
    >>>

    yourself?
    --

    Cameron Laird <>
    Business: http://www.Phaseit.net
    Cameron Laird, Jan 23, 2004
    #4
  5. In article <>, I confused matters with:
    .
    .
    .
    > >>> import Tkinter
    > >>> l = Tkinter.Label()
    > >>> l.winfo_rgb("red")

    > (65535, 0, 0)

    .
    .
    .
    Ugh. I'm revealing a bad habit I acquired in my Python childhood.
    What I *should* have suggested was
    import Tkinter
    Tkinter.Tk().winfo_rgb("cyan")
    The Label() and l chatter was just a distraction, for which I
    apologize.
    --

    Cameron Laird <>
    Business: http://www.Phaseit.net
    Cameron Laird, Jan 23, 2004
    #5
    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. Greg  --
    Replies:
    4
    Views:
    2,152
  2. Replies:
    2
    Views:
    2,817
    Malcolm
    Aug 20, 2005
  3. ChrisC
    Replies:
    2
    Views:
    456
    Roedy Green
    Aug 23, 2007
  4. Allen
    Replies:
    1
    Views:
    635
    Mark Rae [MVP]
    Dec 3, 2007
  5. Kamaljeet Saini
    Replies:
    0
    Views:
    405
    Kamaljeet Saini
    Feb 13, 2009
Loading...

Share This Page