V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
Freedom1
V2EX  ›  问与答

新人求助关于 pyqt

  •  
  •   Freedom1 · 2015-07-22 15:31:30 +08:00 · 2130 次点击
    这是一个创建于 3207 天前的主题,其中的信息可能已经有所发展或是发生改变。

    学python不久,在pyqt怎么实现文件的选取并保存到指定的目录下

    2 条回复
    aec4d
        1
    aec4d  
       2015-07-22 17:21:49 +08:00
    先用QtDesinger绘制一个界面 然后用pyuic5转换成py文件
    然后是使用QFileDialog选择文件
    大概代码是这样
    filters = "Excel (*.xls *.xlsx)"
    browse.getOpenFileName(self, 'Select Files', QDir.currentPath(), filters)[0]
    directory = browse.getExistingDirectory(self, "Select Files", QDir.currentPath())
    然后保存用shutil.copyfile?
    Freedom1
        2
    Freedom1  
    OP
       2015-07-22 23:04:50 +08:00
    @aec4d 我差不多就是用QDialog对话框中的函数来实现,但一直有误,明天我再试试。再向你请教
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2194 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 10:07 · PVG 18:07 · LAX 03:07 · JFK 06:07
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.