标签:import 颜色 man int geometry 打开文件 dialog class loop
代码1:
import 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()
代码2:
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()
标签:import 颜色 man int geometry 打开文件 dialog class loop
原文地址:https://www.cnblogs.com/exesoft/p/12957961.html