颜色选择框可以帮助我们设置前景色, 背景色, 画笔颜色, 字体颜色等等
1 # coding:utf-8 2 from tkinter import * 3 from tkinter.colorchooser import * 4 5 root = Tk() 6 root.geometry(‘530x200‘) 7 8 9 def text01(): 10 s1 = askcolor(color=‘red‘, title=‘选择背景色‘) 11 print(s1) 12 root.config(bg=s1[1]) 13 14 15 Button(root, text=‘选择背景色‘, command=text01).pack() 16 17 root.mainloop()
Python22-05_页面设计----颜色选择框&文件对话框
原文:https://www.cnblogs.com/xujie-0528/p/13719519.html