Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_basic_named_color_chart.py
- from Tkinter import *
- MAX_ROWS = 7
- FONT_SIZE = 10 # (pixels)
- COLORS = 'red', 'orange', 'yellow', 'green', 'blue', 'purple', 'maroon', 'violet', 'gold', 'lime green', 'lawn green', 'dark green', 'navy', 'royal blue', 'turquoise', 'cyan', 'gold3', 'dark khaki', 'khaki', 'gray', 'light grey', 'deep pink', 'hot pink', 'pink'
- root = Tk()
- root.title("Named colour chart")
- row = 0
- col = 0
- for color in COLORS:
- e = Label(root, text=color, background=color,
- font=(None, -FONT_SIZE))
- e.grid(row=row, column=col, sticky=E+W)
- row += 1
- if (row > MAX_ROWS):
- row = 0
- col += 1
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement