This doesn't explain anything, but in my programs I just have this global color
pallet that I use for everything. Color "D" is set to whatever the system
color is for widgets. Then I just use that for, for example, making "greyed
out" Entry fields the same color as their surroundings.
Throughout my code it's just like 'bg = Clr["R"]' or whatever. Initially the
idea behind this was so that if someone was using my programs who was
colorblind, they could just do a menu selection, then a function would change
the appropriate values in the dictionary (like different options for different
types of colorblindness), and the colors of everything would change. Never got
around to that part, of course. :)
# Just use RGB for everything since some things don't handle color names
# correctly, like PIL on OSX doesn't handle "green" very well.
# B = black, C = cyan, G = green, M = magenta, R = red, O = orange, W = white,
# Y = yellow, E = light gray, A = gray, K = dark gray, U = blue,
# N = dark green, S = dark red, y = dark yellow, D = default widget color,
# u = light blue, s = salmon, p = light pink, g = light green,
# r = a little lighter grey almost white, P = Purple, b = dark blue (was U for
# years, but it can be hard to see)
# Orange should be #FF7F00, but #DD5F00 is easier to see on a white background
# and it still looks OK on a black background. Purple should be A020F0, but
# that was a little dark.
Clr = {"B":"#000000", "C":"#00FFFF", "G":"#00FF00", "M":"#FF00FF", \
"R":"#FF0000", "O":"#FF7F00", "W":"#FFFFFF", "Y":"#FFFF00", \
"E":"#DFDFDF", "A":"#8F8F8F", "K":"#3F3F3F", "U":"#0070FF", \
"N":"#007F00", "S":"#7F0000", "y":"#7F7F00", "D":Root.cget("bg"), \
"u":"#ADD8E6", "s":"#FA8072", "p":"#FFB6C1", "g":"#90EE90", \
"r":"#EFEFEF", "P":"#AA22FF", "b":"#0000FF"}
On 2013-05-29, at 10:03, Michael O'Donnell <[email protected]> wrote:
> Dear all,
>
> My application manages the window appearance by building a frame with gifs,
> and filling with a background color that should be identical to that
> of the gifs.
>
> This has been fine under all versions of Python up to and
> including 3.3.2. But under 3.3.2 on MACOSX, Idle recommended I upgrade
> to Tk 8.5.14 (previously I had 8.5.9), so I upgraded from ActiveState.
>
> Now, the background color is a shade or two lighter than the gifs,
> making my interface look clunky.
>
> When I move back to Windows, where the Python installer for 3.3.2
> includes Tk 8.5.11, I have no problem. So I am not sure if it is Tk version
> after 11, or if it is a later version but just on the Mac.
>
> Does anyone know anything about changes to Tk colour rendering
> that might explain this.
>
> A test case is below (Python 3), with the required GIF file in attachment.
> If all is fine, the canvas presents a uniform gray. If there is a small
> lighter gray square in the middle, then you have duplicated the problem.
>
> import tkinter
> root = tkinter.Tk()
> print("TK Version: ", root.getvar("tk_patchLevel"))
> c=tkinter.Canvas(root, bg="#bbc0c6", height=100, width=100)
> c.pack(side='left')
> button=tkinter.PhotoImage(file="left.gif")
> c.create_image(50, 50, anchor="nw", image=button)
> root.mainloop()
>
> Any help welcome,
>
> Mick
> <left.gif>_______________________________________________
> Tkinter-discuss mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/tkinter-discuss
_______________________________________________
Tkinter-discuss mailing list
[email protected]
http://mail.python.org/mailman/listinfo/tkinter-discuss