self color_preview Canvas self width 17 height 17 self color_preview c

1
2
3
4
5
6
7
self.color_preview = Canvas(self, width=17, height=17)
self.color_preview.create_rectangle(0, 0, 17, 17, outline='black', fill='black', tag='1')
self.color_preview.grid(row=0, column=2, padx=3, pady=3)
self.color_selection.bind('<<ComboboxSelected>>', self.color_selected)
def color_selected(self):
self.color_preview.itemconfigure('1', outline=self.color_selection.get(), fill=self.color_selection.get())