import tkinter as tk
from tkinter import filedialog
root = tk.Tk() # 创建一个Tkinter.Tk()实例
root.withdraw() # 将Tkinter.Tk()实例隐藏
import mytkinter
test1 = askopenfilename(defaultextension='.tif', title='test1', filetypes=[(
"文本文档", ".txt"), ('Excel', '.xls .xlsx'), ('All Files', ' *')], multiple=False)
print('test1 'test1)
test2 = askopenfilenames(title='test2', defaultextension='.tif', filetypes=[(
"文本文档", ".txt"), ('Excel', '.xls .xlsx'), ('All Files', ' *')])
print('test2 'test2)
test3 = asksavefilename(title='test3', filetypes=[('All Files', ' *')])
print('test3 'test3)
test4 = askdirectory(title='test4')
print('test4 'test4)
test5 = askforfileslsit(filetype='.*', title='test5')
print('test5 'test5)
test6 = getfilenameslist(title='test6')
print('test6 'test6)
test7 = askforfilespath(filetype='.tif', title='test7')
print('test7 'test7)
test8 = getfilenamespath(title='test8')
print('test8 'test8)
from mytkinter import *
test1 = askopenfilename(defaultextension='.tif', title='test1', filetypes=[(
"文本文档", ".txt"), ('Excel', '.xls .xlsx'), ('All Files', ' *')], multiple=False)
print('test1 'test1)
test2 = askopenfilenames(title='test2', defaultextension='.tif', filetypes=[(
"文本文档", ".txt"), ('Excel', '.xls .xlsx'), ('All Files', ' *')])
print('test2 'test2)
test3 = asksavefilename(title='test3', filetypes=[('All Files', ' *')])
print('test3 'test3)
test4 = askdirectory(title='test4')
print('test4 'test4)
test5 = askforfileslsit(filetype='.*', title='test5')
print('test5 'test5)
test6 = getfilenameslist(title='test6')
print('test6 'test6)
test7 = askforfilespath(filetype='.tif', title='test7')
print('test7 'test7)
test8 = getfilenamespath(title='test8')
print('test8 'test8)
如果需要原代码,请下载
tkinter库扩展使用方法 mytkinter.py
https://download.csdn.net/download/weixin_44630029/12174223
作者:辛特
QQ:774562189
转载请声明