我对Python中的Qt很陌生,我需要知道如何从文件对话框中获取一个目录路径,并在ui中的文本框中显示它。class ControllerLibraryUI(QtWidgets.QDialog):
def __init__(self):
super(ControllerLibraryUI, self).__init__()
self.setWindowTitle('Controller Window')
self.buildUI()
def buildUI(self):
layout = QtWidgets.QVBoxLayout(self)
textWidget = QtWidgets.QWidget()
textLayout = QtWidgets.QHBoxLayout(textWidget)
layout.addWidget(textWidget)
self.saveNameField = QtWidgets.QTextEdit()
textLayout.addWidget(self.saveNameField)
btnWidget = QtWidgets.QWidget()
btnLayout = QtWidgets.QHBoxLayout(btnWidget)
layout.addWidget(btnWidget)
importBtn = QtWidgets.QPushButton('Import')
importBtn.clicked.connect(self.load)
btnLayout.addWidget(importBtn)
closeBtn = QtWidgets.QPushButton('Close')