diff options
author | Barry Warsaw <barry@python.org> | 1998-02-17 03:09:19 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 1998-02-17 03:09:19 (GMT) |
commit | 93737b2da8b267acae383628ea3996fc60b6ab5c (patch) | |
tree | 5aa1965459761d0361bc8f61a16f66a030c2b1de /Tools | |
parent | 7154d382c30a671c327d0eebe54aded7fa3fbd49 (diff) | |
download | cpython-93737b2da8b267acae383628ea3996fc60b6ab5c.zip cpython-93737b2da8b267acae383628ea3996fc60b6ab5c.tar.gz cpython-93737b2da8b267acae383628ea3996fc60b6ab5c.tar.bz2 |
Added method to set selected color to nearest.
Collapsed `Options' group into `Current Color' group
Set delegate of reds, greens, blues
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/pynche/PyncheWidget.py | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/Tools/pynche/PyncheWidget.py b/Tools/pynche/PyncheWidget.py index cac8a53..44398d7 100644 --- a/Tools/pynche/PyncheWidget.py +++ b/Tools/pynche/PyncheWidget.py @@ -53,41 +53,44 @@ class PyncheWidget(Pmw.MegaWidget): interiorarg = (self.interior(),) # create color selectors - group = Pmw.Group(parent, tag_text='Color Selectors') + group = Pmw.Group(parent, tag_text='Variations') group.pack(side=TOP, expand=YES, fill=BOTH) self.__reds = StripWidget(group.interior(), generator=constant_cyan_generator, - axis=0) + axis=0, label='Red Variations') self.__reds.pack() self.__blues = StripWidget(group.interior(), generator=constant_magenta_generator, - axis=1) + axis=1, label='Green Variations') self.__blues.pack() self.__greens = StripWidget(group.interior(), generator=constant_yellow_generator, - axis=2) + axis=2, label='Blue Variations') self.__greens.pack() # create chip window group = Pmw.Group(parent, tag_text='Current Color') - group.pack(side=LEFT, fill=Y) + group.pack(side=LEFT, expand=YES, fill=BOTH) self.__selected = ChipWidget(group.interior(), label_text='Selected') self.__selected.grid() self.__nearest = ChipWidget(group.interior(), label_text='Nearest') self.__nearest.grid(row=0, column=1) + chip = self.__nearest.component('chip') + chip.bind('<ButtonRelease-1>', self.__set_color_to_chip) # create the options window - group = Pmw.Group(parent, tag_text='Options') - group.pack(expand=YES, fill=BOTH) self.__typein = TypeinWidget(group.interior()) - self.__typein.grid() + self.__typein.grid(row=0, column=2) # Check keywords and initialize options self.initialiseoptions(PyncheWidget) self.__typein.configure(delegate=self) + self.__reds.configure(delegate=self) + self.__greens.configure(delegate=self) + self.__blues.configure(delegate=self) # # PUBLIC INTERFACE @@ -121,3 +124,8 @@ class PyncheWidget(Pmw.MegaWidget): def __set_color(self): self.set_color(self, self['color']) + + def __set_color_to_chip(self, event=None): + color = self.__nearest['color'] + rgbtuple = self.__colordb.find_byname(color) + self.set_color(self, rgbtuple) |