当前位置:首页 > Python教程 > python技巧

Python22-05_页面设计----颜色选择框&文件对话框

颜色选择框&文件对话框

颜色选择框

颜色选择框可以帮助我们设置前景色, 背景色, 画笔颜色, 字体颜色等等

             1
            #
             coding:utf-8
             2
            from tkinter import *
 3from tkinter.colorchooser import *
 4 5 root = Tk()
 6 root.geometry(530x200)
 7 8 9def text01():
10     s1 = askcolor(color=red, title=选择背景色)
11print(s1)
12     root.config(bg=s1[1])
131415 Button(root, text=选择背景色, command=text01).pack()
1617 root.mainloop()

技术分享图片

 

 技术分享图片

 

原文:https://www.cnblogs.com/xujie-0528/p/13719519.html


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!