[Tkinter-discuss] Custom Colors in tkColorChooser dialog

david.giesen at kodak.com david.giesen at kodak.com
Tue Nov 11 17:06:29 CET 2008


Ok - I was afraid of that.  Thanks!

Dave

David J. Giesen | Research Scientist | FPEG US Display OLED Materials R+D 
| 
Eastman Kodak Company | 2/83/KRL MC02216 | Rochester, NY 14650 | 
david.giesen at kodak.com | 1-585-588-0480 Office | 
www.kodak.com 

"Guilherme Polo" <ggpolo at gmail.com> wrote on 11/11/2008 09:40:04 AM:

> On Tue, Nov 11, 2008 at 12:11 PM,  <david.giesen at kodak.com> wrote:
> > Hi -
> >
> > When invoking the tkColorChooser.askcolor() dialog on Windows, a 
window
> > pops up that shows on the lefthand side a grid of basic color patches 
and
> > two rows of custom color patches.
> >
> > The custom color patches by default seem to simply be a set of reds 
and
> > purples.  The user can modify these, but the modifications only last 
for
> > the duration of the program - the next time it starts, the colors are 
back
> > to the defaults.  Is there any way to modify this set of custom colors 
via
> > code?
> 
> tkColorChooser is platform specific, on windows it actually uses
> ColorChooser (check msdn for that) to display the color picker dialog.
> On unix != macosx you will get a generic one which doesn't even have a
> palette.
> Even if you want to target only Windows, I don't think you can add a
> hook (be it through pywin32, ctypes, ..) into windows' colorchooser to
> load a custom palette. It is possible that there are better functions
> for this in the windows api (which then could be suggested in the tk
> bug tracker to replace or use if available instead of ColorChooser),
> or maybe it is even possible to add a hook in ColorChooser somehow but
> I don't know how offhand.
> 
> Now, the less hacky option is to create a widget yourself. tk comes
> with a demo called tcolor which already supports rgb, cmy and hsb, so
> all you have to do is put a "pallete bar" on it (and convert it to
> python =) ) and have total control over it.
> 
> > I'd like to present the users with a custom template for a program
> > I'm writing.
> >
> > Thanks!
> >
> > Dave
> >
> > David J. Giesen | Research Scientist | FPEG US Display OLED Materials 
R+D
> > |
> > Eastman Kodak Company | 2/83/KRL MC02216 | Rochester, NY 14650 |
> > david.giesen at kodak.com | 1-585-588-0480 Office |
> > www.kodak.com
> >
> 
> 
> -- 
> -- Guilherme H. Polo Goncalves



More information about the Tkinter-discuss mailing list