Freedom1
V2EX  ›  问与答

新人求助关于 pyqt

  •  
  •   Freedom1 · Jul 22, 2015 · 2969 views
    This topic created in 4022 days ago, the information mentioned may be changed or developed.

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

    2 replies
    aec4d
        1
    aec4d  
       Jul 22, 2015
    先用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
       Jul 22, 2015
    @aec4d 我差不多就是用QDialog对话框中的函数来实现,但一直有误,明天我再试试。再向你请教
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2831 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 11:03 · PVG 19:03 · LAX 04:03 · JFK 07:03
    ♥ Do have faith in what you're doing.