1 Star 1 Fork 1

okay6/paddlepaddle-model

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
file.py 1.88 KB
一键复制 编辑 原始数据 按行查看 历史
coding666 提交于 2018-07-24 13:00 . Add files via upload
#-*- coding:utf-8 -*-
#######pyqt 文件载入对话框,文件保存对话框,打开文件夹对话框
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import sys
class MyWindow(QDialog,QWidget):
def __init__(self,parent = None):
super(MyWindow,self).__init__(parent)
self.resize(400,150)
self.mainlayout = QGridLayout(self)
self.loadFileButton = QPushButton()
self.loadFileButton.setText(u"载入文件")
self.mainlayout.addWidget(self.loadFileButton,0,0,1,1)
self.loadFileLineEdit = QLineEdit()
self.mainlayout.addWidget(self.loadFileLineEdit,0,1,1,4)
self.loadFileButton.clicked.connect(self.loadFile)
self.saveFileButton = QPushButton()
self.saveFileButton.setText(u"保存文件")
self.saveFileLineEdit = QLineEdit()
self.mainlayout.addWidget(self.saveFileButton,1,0,1,1)
self.mainlayout.addWidget(self.saveFileLineEdit,1,1,1,4)
self.saveFileButton.clicked.connect(self.saveFile)
self.openFileDirButton = QPushButton()
self.openFileDirButton.setText(u"打开文件目录")
self.mainlayout.addWidget(self.openFileDirButton,2,0,1,1)
self.openFileDirButton.clicked.connect(self.openFileDirectory)
def loadFile(self):########载入file
file_name = QFileDialog.getOpenFileName(self,"open file dialog","./home/fish","Txt files(*.txt)")
##"open file Dialog "文件对话框的标题,第二个是打开的默认路径,第三个是文件类型
self.loadFileLineEdit.setText(file_name)
def saveFile(self):
file_path = QFileDialog.getSaveFileName(self,'save file',"saveFile" ,"xj3dp files (*.xj3dp);;all files(*.*)") ####
print file_path
def openFileDirectory(self):
import os
os.popen("explorer.exe ./home/fish")
app=QApplication(sys.argv)
window=MyWindow()
window.show()
app.exec_()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/okay_6/paddlepaddle-model.git
git@gitee.com:okay_6/paddlepaddle-model.git
okay_6
paddlepaddle-model
paddlepaddle-model
master

搜索帮助