import tkinter as tk
from tkinter import colorchooser
root = tk.Tk()
root.title("颜色选择")
root.geometry('400x200+300+300')
root.iconbitmap('../image/icon.ico')
def callback():
# 打开颜色对话款
colorvalue = tk.colorchooser.askcolor()
# 在颜色面板点击确定后,会在窗口显示二元组颜色值
lb.config(text='颜色值:' + str(colorvalue))
lb = tk.Label(root, text='', font=('宋体', 10))
# 将label标签放置在主窗口
lb.pack()
tk.Button(root, text="点击选择颜色", command=callback, width=10, bg='#9AC0CD').pack()
# 显示界面
root.mainloop()