def create_widgets(self): swatch = TkUtil.swatch(self.foreground, outline="#FFF") self.__swatches[self.foreground] = swatch self.foregroundButton = ttk.Button(self, text="Foreground ", image=swatch, compound=tk.RIGHT, command=lambda: self.__set_color(FOREGROUND)) swatch = self.__get_swatch(self.background) self.backgroundButton = ttk.Button(self, text="Background ", image=swatch, compound=tk.RIGHT, command=lambda: self.__set_color(BACKGROUND))
def create_widgets(self): swatch = TkUtil.swatch(self.foreground, outline="#FFF") self.__swatches[self.foreground] = swatch self.foregroundButton = ttk.Button( self, text="Foreground ", image=swatch, compound=tk.RIGHT, command=lambda: self.__set_color(FOREGROUND)) swatch = self.__get_swatch(self.background) self.backgroundButton = ttk.Button( self, text="Background ", image=swatch, compound=tk.RIGHT, command=lambda: self.__set_color(BACKGROUND))
def __get_swatch(self, color): swatch = self.__swatches.get(color) if swatch is None: swatch = TkUtil.swatch(color) self.__swatches[color] = swatch return swatch