python - Colour chart for Tkinter and Tix -
this isn't question answer others might run issue.
i wanted visualise basic colours, pick appropriate ones colour scheme. couldn't find colour chart anywhere modified sample display hope find useful.
import tix tk # import tkinter.tix tk # python 3 colors =['snow', 'ghost white', 'white smoke', 'gainsboro', 'floral white', 'old lace', 'linen', 'antique white', 'papaya whip', 'blanched almond', 'bisque', 'peach puff', 'navajo white', 'lemon chiffon', 'mint cream', 'azure', 'alice blue', 'lavender', 'lavender blush', 'misty rose', 'dark slate gray', 'dim gray', 'slate gray', 'light slate gray', 'gray', 'light grey', 'midnight blue', 'navy', 'cornflower blue', 'dark slate blue', 'slate blue', 'medium slate blue', 'light slate blue', 'medium blue', 'royal blue', 'blue', 'dodger blue', 'deep sky blue', 'sky blue', 'light sky blue', 'steel blue', 'light steel blue', 'light blue', 'powder blue', 'pale turquoise', 'dark turquoise', 'medium turquoise', 'turquoise', 'cyan', 'light cyan', 'cadet blue', 'medium aquamarine', 'aquamarine', 'dark green', 'dark olive green', 'dark sea green', 'sea green', 'medium sea green', 'light sea green', 'pale green', 'spring green', 'lawn green', 'medium spring green', 'green yellow', 'lime green', 'yellow green', 'forest green', 'olive drab', 'dark khaki', 'khaki', 'pale goldenrod', 'light goldenrod yellow', 'light yellow', 'yellow', 'gold', 'light goldenrod', 'goldenrod', 'dark goldenrod', 'rosy brown', 'indian red', 'saddle brown', 'sandy brown', 'dark salmon', 'salmon', 'light salmon', 'orange', 'dark orange', 'coral', 'light coral', 'tomato', 'orange red', 'red', 'hot pink', 'deep pink', 'pink', 'light pink', 'pale violet red', 'maroon', 'medium violet red', 'violet red', 'medium orchid', 'dark orchid', 'dark violet', 'blue violet', 'purple', 'medium purple', 'thistle', 'snow2', 'snow3', 'snow4', 'seashell2', 'seashell3', 'seashell4', 'antiquewhite1', 'antiquewhite2', 'antiquewhite3', 'antiquewhite4', 'bisque2', 'bisque3', 'bisque4', 'peachpuff2', 'peachpuff3', 'peachpuff4', 'navajowhite2', 'navajowhite3', 'navajowhite4', 'lemonchiffon2', 'lemonchiffon3', 'lemonchiffon4', 'cornsilk2', 'cornsilk3', 'cornsilk4', 'ivory2', 'ivory3', 'ivory4', 'honeydew2', 'honeydew3', 'honeydew4', 'lavenderblush2', 'lavenderblush3', 'lavenderblush4', 'mistyrose2', 'mistyrose3', 'mistyrose4', 'azure2', 'azure3', 'azure4', 'slateblue1', 'slateblue2', 'slateblue3', 'slateblue4', 'royalblue1', 'royalblue2', 'royalblue3', 'royalblue4', 'blue2', 'blue4', 'dodgerblue2', 'dodgerblue3', 'dodgerblue4', 'steelblue1', 'steelblue2', 'steelblue3', 'steelblue4', 'deepskyblue2', 'deepskyblue3', 'deepskyblue4', 'skyblue1', 'skyblue2', 'skyblue3', 'skyblue4', 'lightskyblue1', 'lightskyblue2', 'lightskyblue3', 'lightskyblue4', 'slategray1', 'slategray2', 'slategray3', 'slategray4', 'lightsteelblue1', 'lightsteelblue2', 'lightsteelblue3', 'lightsteelblue4', 'lightblue1', 'lightblue2', 'lightblue3', 'lightblue4', 'lightcyan2', 'lightcyan3', 'lightcyan4', 'paleturquoise1', 'paleturquoise2', 'paleturquoise3', 'paleturquoise4', 'cadetblue1', 'cadetblue2', 'cadetblue3', 'cadetblue4', 'turquoise1', 'turquoise2', 'turquoise3', 'turquoise4', 'cyan2', 'cyan3', 'cyan4', 'darkslategray1', 'darkslategray2', 'darkslategray3', 'darkslategray4', 'aquamarine2', 'aquamarine4', 'darkseagreen1', 'darkseagreen2', 'darkseagreen3', 'darkseagreen4', 'seagreen1', 'seagreen2', 'seagreen3', 'palegreen1', 'palegreen2', 'palegreen3', 'palegreen4', 'springgreen2', 'springgreen3', 'springgreen4', 'green2', 'green3', 'green4', 'chartreuse2', 'chartreuse3', 'chartreuse4', 'olivedrab1', 'olivedrab2', 'olivedrab4', 'darkolivegreen1', 'darkolivegreen2', 'darkolivegreen3', 'darkolivegreen4', 'khaki1', 'khaki2', 'khaki3', 'khaki4', 'lightgoldenrod1', 'lightgoldenrod2', 'lightgoldenrod3', 'lightgoldenrod4', 'lightyellow2', 'lightyellow3', 'lightyellow4', 'yellow2', 'yellow3', 'yellow4', 'gold2', 'gold3', 'gold4', 'goldenrod1', 'goldenrod2', 'goldenrod3', 'goldenrod4', 'darkgoldenrod1', 'darkgoldenrod2', 'darkgoldenrod3', 'darkgoldenrod4', 'rosybrown1', 'rosybrown2', 'rosybrown3', 'rosybrown4', 'indianred1', 'indianred2', 'indianred3', 'indianred4', 'sienna1', 'sienna2', 'sienna3', 'sienna4', 'burlywood1', 'burlywood2', 'burlywood3', 'burlywood4', 'wheat1', 'wheat2', 'wheat3', 'wheat4', 'tan1', 'tan2', 'tan4', 'chocolate1', 'chocolate2', 'chocolate3', 'firebrick1', 'firebrick2', 'firebrick3', 'firebrick4', 'brown1', 'brown2', 'brown3', 'brown4', 'salmon1', 'salmon2', 'salmon3', 'salmon4', 'lightsalmon2', 'lightsalmon3', 'lightsalmon4', 'orange2', 'orange3', 'orange4', 'darkorange1', 'darkorange2', 'darkorange3', 'darkorange4', 'coral1', 'coral2', 'coral3', 'coral4', 'tomato2', 'tomato3', 'tomato4', 'orangered2', 'orangered3', 'orangered4', 'red2', 'red3', 'red4', 'deeppink2', 'deeppink3', 'deeppink4', 'hotpink1', 'hotpink2', 'hotpink3', 'hotpink4', 'pink1', 'pink2', 'pink3', 'pink4', 'lightpink1', 'lightpink2', 'lightpink3', 'lightpink4', 'palevioletred1', 'palevioletred2', 'palevioletred3', 'palevioletred4', 'maroon1', 'maroon2', 'maroon3', 'maroon4', 'violetred1', 'violetred2', 'violetred3', 'violetred4', 'magenta2', 'magenta3', 'magenta4', 'orchid1', 'orchid2', 'orchid3', 'orchid4', 'plum1', 'plum2', 'plum3', 'plum4', 'mediumorchid1', 'mediumorchid2', 'mediumorchid3', 'mediumorchid4', 'darkorchid1', 'darkorchid2', 'darkorchid3', 'darkorchid4', 'purple1', 'purple2', 'purple3', 'purple4', 'mediumpurple1', 'mediumpurple2', 'mediumpurple3', 'mediumpurple4', 'thistle1', 'thistle2', 'thistle3', 'thistle4', 'gray1', 'gray2', 'gray3', 'gray4', 'gray5', 'gray6', 'gray7', 'gray8', 'gray9', 'gray10', 'gray11', 'gray12', 'gray13', 'gray14', 'gray15', 'gray16', 'gray17', 'gray18', 'gray19', 'gray20', 'gray21', 'gray22', 'gray23', 'gray24', 'gray25', 'gray26', 'gray27', 'gray28', 'gray29', 'gray30', 'gray31', 'gray32', 'gray33', 'gray34', 'gray35', 'gray36', 'gray37', 'gray38', 'gray39', 'gray40', 'gray42', 'gray43', 'gray44', 'gray45', 'gray46', 'gray47', 'gray48', 'gray49', 'gray50', 'gray51', 'gray52', 'gray53', 'gray54', 'gray55', 'gray56', 'gray57', 'gray58', 'gray59', 'gray60', 'gray61', 'gray62', 'gray63', 'gray64', 'gray65', 'gray66', 'gray67', 'gray68', 'gray69', 'gray70', 'gray71', 'gray72', 'gray73', 'gray74', 'gray75', 'gray76', 'gray77', 'gray78', 'gray79', 'gray80', 'gray81', 'gray82', 'gray83', 'gray84', 'gray85', 'gray86', 'gray87', 'gray88', 'gray89', 'gray90', 'gray91', 'gray92', 'gray93', 'gray94', 'gray95', 'gray97', 'gray98', 'gray99'] def drawframes(_sw): c in colors: e= tk.label(sw.window, text = c, background = c) e.pack(fill = tk.x) r= tk.tk() r.title("named colour chart") sw= tk.scrolledwindow(r, scrollbar=tk.both) sw.pack(fill=tk.both, expand=1) drawframes(sw) r.mainloop()
for it's worth, here's version doesn't require tix
. uses grid
manager can see colors @ same time. may want adjust max_rows
, font_size
display.
import tkinter tk colors = ['snow', 'ghost white', 'white smoke', 'gainsboro', 'floral white', 'old lace', 'linen', 'antique white', 'papaya whip', 'blanched almond', 'bisque', 'peach puff', 'navajo white', 'lemon chiffon', 'mint cream', 'azure', 'alice blue', 'lavender', 'lavender blush', 'misty rose', 'dark slate gray', 'dim gray', 'slate gray', 'light slate gray', 'gray', 'light grey', 'midnight blue', 'navy', 'cornflower blue', 'dark slate blue', 'slate blue', 'medium slate blue', 'light slate blue', 'medium blue', 'royal blue', 'blue', 'dodger blue', 'deep sky blue', 'sky blue', 'light sky blue', 'steel blue', 'light steel blue', 'light blue', 'powder blue', 'pale turquoise', 'dark turquoise', 'medium turquoise', 'turquoise', 'cyan', 'light cyan', 'cadet blue', 'medium aquamarine', 'aquamarine', 'dark green', 'dark olive green', 'dark sea green', 'sea green', 'medium sea green', 'light sea green', 'pale green', 'spring green', 'lawn green', 'medium spring green', 'green yellow', 'lime green', 'yellow green', 'forest green', 'olive drab', 'dark khaki', 'khaki', 'pale goldenrod', 'light goldenrod yellow', 'light yellow', 'yellow', 'gold', 'light goldenrod', 'goldenrod', 'dark goldenrod', 'rosy brown', 'indian red', 'saddle brown', 'sandy brown', 'dark salmon', 'salmon', 'light salmon', 'orange', 'dark orange', 'coral', 'light coral', 'tomato', 'orange red', 'red', 'hot pink', 'deep pink', 'pink', 'light pink', 'pale violet red', 'maroon', 'medium violet red', 'violet red', 'medium orchid', 'dark orchid', 'dark violet', 'blue violet', 'purple', 'medium purple', 'thistle', 'snow2', 'snow3', 'snow4', 'seashell2', 'seashell3', 'seashell4', 'antiquewhite1', 'antiquewhite2', 'antiquewhite3', 'antiquewhite4', 'bisque2', 'bisque3', 'bisque4', 'peachpuff2', 'peachpuff3', 'peachpuff4', 'navajowhite2', 'navajowhite3', 'navajowhite4', 'lemonchiffon2', 'lemonchiffon3', 'lemonchiffon4', 'cornsilk2', 'cornsilk3', 'cornsilk4', 'ivory2', 'ivory3', 'ivory4', 'honeydew2', 'honeydew3', 'honeydew4', 'lavenderblush2', 'lavenderblush3', 'lavenderblush4', 'mistyrose2', 'mistyrose3', 'mistyrose4', 'azure2', 'azure3', 'azure4', 'slateblue1', 'slateblue2', 'slateblue3', 'slateblue4', 'royalblue1', 'royalblue2', 'royalblue3', 'royalblue4', 'blue2', 'blue4', 'dodgerblue2', 'dodgerblue3', 'dodgerblue4', 'steelblue1', 'steelblue2', 'steelblue3', 'steelblue4', 'deepskyblue2', 'deepskyblue3', 'deepskyblue4', 'skyblue1', 'skyblue2', 'skyblue3', 'skyblue4', 'lightskyblue1', 'lightskyblue2', 'lightskyblue3', 'lightskyblue4', 'slategray1', 'slategray2', 'slategray3', 'slategray4', 'lightsteelblue1', 'lightsteelblue2', 'lightsteelblue3', 'lightsteelblue4', 'lightblue1', 'lightblue2', 'lightblue3', 'lightblue4', 'lightcyan2', 'lightcyan3', 'lightcyan4', 'paleturquoise1', 'paleturquoise2', 'paleturquoise3', 'paleturquoise4', 'cadetblue1', 'cadetblue2', 'cadetblue3', 'cadetblue4', 'turquoise1', 'turquoise2', 'turquoise3', 'turquoise4', 'cyan2', 'cyan3', 'cyan4', 'darkslategray1', 'darkslategray2', 'darkslategray3', 'darkslategray4', 'aquamarine2', 'aquamarine4', 'darkseagreen1', 'darkseagreen2', 'darkseagreen3', 'darkseagreen4', 'seagreen1', 'seagreen2', 'seagreen3', 'palegreen1', 'palegreen2', 'palegreen3', 'palegreen4', 'springgreen2', 'springgreen3', 'springgreen4', 'green2', 'green3', 'green4', 'chartreuse2', 'chartreuse3', 'chartreuse4', 'olivedrab1', 'olivedrab2', 'olivedrab4', 'darkolivegreen1', 'darkolivegreen2', 'darkolivegreen3', 'darkolivegreen4', 'khaki1', 'khaki2', 'khaki3', 'khaki4', 'lightgoldenrod1', 'lightgoldenrod2', 'lightgoldenrod3', 'lightgoldenrod4', 'lightyellow2', 'lightyellow3', 'lightyellow4', 'yellow2', 'yellow3', 'yellow4', 'gold2', 'gold3', 'gold4', 'goldenrod1', 'goldenrod2', 'goldenrod3', 'goldenrod4', 'darkgoldenrod1', 'darkgoldenrod2', 'darkgoldenrod3', 'darkgoldenrod4', 'rosybrown1', 'rosybrown2', 'rosybrown3', 'rosybrown4', 'indianred1', 'indianred2', 'indianred3', 'indianred4', 'sienna1', 'sienna2', 'sienna3', 'sienna4', 'burlywood1', 'burlywood2', 'burlywood3', 'burlywood4', 'wheat1', 'wheat2', 'wheat3', 'wheat4', 'tan1', 'tan2', 'tan4', 'chocolate1', 'chocolate2', 'chocolate3', 'firebrick1', 'firebrick2', 'firebrick3', 'firebrick4', 'brown1', 'brown2', 'brown3', 'brown4', 'salmon1', 'salmon2', 'salmon3', 'salmon4', 'lightsalmon2', 'lightsalmon3', 'lightsalmon4', 'orange2', 'orange3', 'orange4', 'darkorange1', 'darkorange2', 'darkorange3', 'darkorange4', 'coral1', 'coral2', 'coral3', 'coral4', 'tomato2', 'tomato3', 'tomato4', 'orangered2', 'orangered3', 'orangered4', 'red2', 'red3', 'red4', 'deeppink2', 'deeppink3', 'deeppink4', 'hotpink1', 'hotpink2', 'hotpink3', 'hotpink4', 'pink1', 'pink2', 'pink3', 'pink4', 'lightpink1', 'lightpink2', 'lightpink3', 'lightpink4', 'palevioletred1', 'palevioletred2', 'palevioletred3', 'palevioletred4', 'maroon1', 'maroon2', 'maroon3', 'maroon4', 'violetred1', 'violetred2', 'violetred3', 'violetred4', 'magenta2', 'magenta3', 'magenta4', 'orchid1', 'orchid2', 'orchid3', 'orchid4', 'plum1', 'plum2', 'plum3', 'plum4', 'mediumorchid1', 'mediumorchid2', 'mediumorchid3', 'mediumorchid4', 'darkorchid1', 'darkorchid2', 'darkorchid3', 'darkorchid4', 'purple1', 'purple2', 'purple3', 'purple4', 'mediumpurple1', 'mediumpurple2', 'mediumpurple3', 'mediumpurple4', 'thistle1', 'thistle2', 'thistle3', 'thistle4', 'gray1', 'gray2', 'gray3', 'gray4', 'gray5', 'gray6', 'gray7', 'gray8', 'gray9', 'gray10', 'gray11', 'gray12', 'gray13', 'gray14', 'gray15', 'gray16', 'gray17', 'gray18', 'gray19', 'gray20', 'gray21', 'gray22', 'gray23', 'gray24', 'gray25', 'gray26', 'gray27', 'gray28', 'gray29', 'gray30', 'gray31', 'gray32', 'gray33', 'gray34', 'gray35', 'gray36', 'gray37', 'gray38', 'gray39', 'gray40', 'gray42', 'gray43', 'gray44', 'gray45', 'gray46', 'gray47', 'gray48', 'gray49', 'gray50', 'gray51', 'gray52', 'gray53', 'gray54', 'gray55', 'gray56', 'gray57', 'gray58', 'gray59', 'gray60', 'gray61', 'gray62', 'gray63', 'gray64', 'gray65', 'gray66', 'gray67', 'gray68', 'gray69', 'gray70', 'gray71', 'gray72', 'gray73', 'gray74', 'gray75', 'gray76', 'gray77', 'gray78', 'gray79', 'gray80', 'gray81', 'gray82', 'gray83', 'gray84', 'gray85', 'gray86', 'gray87', 'gray88', 'gray89', 'gray90', 'gray91', 'gray92', 'gray93', 'gray94', 'gray95', 'gray97', 'gray98', 'gray99'] class colorchart(tk.frame): max_rows = 36 font_size = 10 def __init__(self, root): tk.frame.__init__(self, root) r = 0 c = 0 color in colors: label = tk.label(self, text=color, bg=color, font=("times", self.font_size, "bold")) label.grid(row=r, column=c, sticky="ew") r += 1 if r > self.max_rows: r = 0 c += 1 self.pack(expand=1, fill="both") if __name__ == '__main__': root = tk.tk() root.title("named color chart") app = colorchart(root) root.mainloop()
Comments
Post a Comment