Within Tk/tkinter there a number of colors that have names. Create a window (chart) that displays these colors.
Use the list of the color names found
here .
Use the following code template to create your Python program.
# ============================================================== # My Color Chart Program # # Name: ............ # date: dd/mm/yyyy # ============================================================== from tkinter import * from tk_color_names import COLORS # -------------------------------------------------------------- # global variables # -------------------------------------------------------------- fontFamily = 'arial' fontSize = 10 fontWeight = 'bold' maxRowColors = 20 # -------------------------------------------------------------- # functions # -------------------------------------------------------------- def ColorChart(root): ........................... ........................... ........................... ........................... # -------------------------------------------------------------- # main # -------------------------------------------------------------- if __name__ == '__main__': root = Tk() root.title('Color Chart') ccount = ColorChart(root) print('The color chart contains {} colors.'.format(ccount)) root.mainloop()
1. The above program assumes displaying colors horizontally. Try displaying the the colors vertically. (maxColumnColors vs maxRowColors)
2. Add "stuff" to the file and use pydoc to generate documentation.
3. Use name spaces.
import tkinter as tk import tk_color_name as color