Here my class definition:
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
#...
self.destinoButton.clicked.connect(self.destination)
#...
def destination( self ): #Now instead of "self" is "MainWindow".
self.
folderPath = QtWidgets.
QFileDialog.
getExistingDirectory(self,
'Select folder');
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
#...
self.destinoButton.clicked.connect(self.destination)
#...
def destination( self ): #Now instead of "self" is "MainWindow".
self.folderPath = QtWidgets.QFileDialog.getExistingDirectory(self, 'Select folder');
To copy to clipboard, switch view to plain text mode
I changed "self" to "MainWindow" and is working fine. I have no idea why, by is working. I'm newbie in Python.
Bookmarks