标签:gets src for 最简 efi http idg bsp show
import sys import os from PyQt5.QtWidgets import QApplication,QWidget,QFileDialog from t import Ui_Form class myform(QWidget,Ui_Form): def __init__(self): super().__init__() self.setupUi(self) self.btn1.clicked.connect(self.btn_clear) self.btn2.clicked.connect(self.btn_open) self.btn3.clicked.connect(self.btn_save) self.show() def btn_clear(self): self.text.clear() def btn_open(self): filename=QFileDialog.getOpenFileName(self,‘open file‘,‘/home/jm/study‘) with open(filename[0],‘r‘) as f: my_txt=f.read() self.text.setPlainText(my_txt) def btn_save(self): filename=QFileDialog.getSaveFileName(self,‘save file‘,‘/home/jm/study‘) with open(filename[0],‘w‘) as f: my_text=self.text.toPlainText() f.write(my_text) if __name__==‘__main__‘: app=QApplication(sys.argv) w=myform() app.exec_()
标签:gets src for 最简 efi http idg bsp show
原文地址:http://www.cnblogs.com/jmlovepython/p/7399166.html