wxpython 弹窗选中一个到多个文件

#选择目录
if __name__ == "__main__":
    app = wx.PySimpleApp()
    dialog = wx.DirDialog(None, "Choose a directory:",
                          style=wx.DD_DEFAULT_STYLE | wx.DD_NEW_DIR_BUTTON)
    if dialog.ShowModal() == wx.ID_OK:
        path = dialog.GetPath()
        print path
        wx.Execute("explorer " + path)

    dialog.Destroy()




# 选择一个到多个文件
if __name__ == "__main__":

    app = wx.PySimpleApp()
    filesFilter = "All files (*.*)|*.*"
    fileDialog = wx.FileDialog(None, message="Choose a directory:", wildcard=filesFilter, style=wx.FD_OPEN | wx.FD_MULTIPLE)
    dialogResult = fileDialog.ShowModal()
    if dialogResult != wx.ID_OK:
        pass
    paths = fileDialog.GetPaths()
    print paths

    fileDialog.Destroy()



 wx.FD_MULTIPLE,这个如果删除就只能选中一个文件。
























 

posted @ 2019-09-25 15:10  匡威~万斯  阅读(857)  评论(0编辑  收藏  举报