V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Freedom1
V2EX  ›  问与答

新人求助关于 pyqt

  •  
  •   Freedom1 · Jul 22, 2015 · 2826 views
    This topic created in 3935 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   ·   836 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 21:58 · PVG 05:58 · LAX 14:58 · JFK 17:58
    ♥ Do have faith in what you're doing.