选择打开选择文件 神龙 QQ29295842

#!/usr/local/bin/python
#-*- coding: UTF-8 -*-
#选择打开选择文件  神龙  QQ29295842
import tkmessageBox,tkFileDialog
import platform
import subprocess
if __name__ == "__main__":
    #subprocess.Popen("explorer /select,\"" + "C:\Users\sss" + "\\")
#    import tkFileDialog
#    tkFileDialog.askopenfile()
#    import win32ui
#    dlg = win32ui.CreateFileDialog(1, "*.txt", None, 0, u"txt 文本 (*.txt)|*.txt|All files|*.*")

    systype = platform.system() # 判断系统类型
    if systype == 'Windows':
        basedir = 'c:\\'
    else:
        basedir = '/'
    filename = tkFileDialog.askopenfilename(initialdir=basedir)
    tkMessageBox.showwarning(title='选择的文件', message=filename)

赞 (0) 评论 分享 ()