Python-GUI程序设计-3
2021-01-10 05:32
标签:import 颜色 man int geometry 打开文件 dialog class loop 代码1: 代码2: Python-GUI程序设计-3 标签:import 颜色 man int geometry 打开文件 dialog class loop 原文地址:https://www.cnblogs.com/exesoft/p/12957961.htmlimport tkinter.filedialog
from tkinter import *
from tkinter import messagebox
def OpenFile():
filename=filedialog.askopenfilename()
messagebox.showinfo("温馨提示:",filename)
w=Tk()
w.title("打开文档测试")
Button(w,text="打开文件",command=OpenFile).pack()
w.mainloop()
import tkinter.colorchooser
from tkinter import *
from tkinter import messagebox
def OpenColor():
colorvalue=colorchooser.askcolor()
messagebox.showinfo("温馨提示:",colorvalue)
w=Tk()
w.geometry("500x500")
Button(w,text="选择颜色",command=OpenColor).pack()
w.mainloop()
下一篇:js代码字符串判断