采用Pyqt5中textEdit控件实现
from PyQt5.QtWidgets import *
from excel分成好几个分件.ui.GuessDoor import Ui_Dialog #
import os
from prettytable import *
import openpyxl
class MyForm(QDialog):
def __init__(self):
super().__init__()
self.ui = Ui_Dialog()
self.ui.setupUi(self)
self.setAcceptDrops(True)
self.init_singal()
def init_singal(self):
self.ui.textEdit.textChanged.connect(self.editchange)
def editchange(self):
if 'file:///' in self.ui.textEdit.toPlainText():
self.ui.textEdit.setText(self.ui.textEdit.toPlainText().replace('file:///', ''))
def dragEnterEvent(self, event):
self.ui.textEdit.setText("")
if __name__=="__main__":
app = QApplication(sys.argv)
w = MyForm()
w.show()
sys.exit(app.exec_())