Кто может подсказать, почему выдает ошибку 0xC0000409 при нажатии кнопки?
from PyQt6 import QtCore, QtGui, QtWidgets
import sys
import os
from PyQt6.QtGui import *
from PyQt6.QtCore import *
from PyQt6.QtWidgets import *
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(800, 600)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.knopka = QtWidgets.QPushButton(self.centralwidget)
self.knopka.setGeometry(QtCore.QRect(90, 100, 201, 101))
self.knopka.setObjectName("knopka")
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 21))
self.menubar.setObjectName("menubar")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
self.knopka.clicked.connect(self.getDirectory)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.knopka.setText(_translate("MainWindow", "PushButton"))
def getDirectory(self): # <-----
dirlist = QFileDialog.getExistingDirectory(self, "Выбрать папку", ".")
self.plainTextEdit.appendHtml("<br>Выбрали папку: <b>{}</b>".format(dirlist))
print(dirlist)
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec())