Note that there are some explanatory texts on larger screens.

plurals
  1. POargument 1 has unexpected type 'Ui_mainWindow'
    text
    copied!<p>I'm trying to make a GUI for a small program I wrote with the help of some people from here, anyway, I made the GUI in PyQt and it looks fine. I added a button called dirButton that says "Choose Directory"</p> <pre><code>self.dirButton = QtGui.QPushButton(self.buttonWidget) self.dirButton.setGeometry(QtCore.QRect(0, 0, 91, 61)) self.dirButton.setObjectName(_fromUtf8("dirButton")) self.dirButton.clicked.connect(self.browse) </code></pre> <p>and in the bottom line there I've made it call self.browse when I click it, which is:</p> <pre><code>def browse(self): filename = QtGui.QFileDialog.getOpenFileName(self, 'Open File', '.') fname = open(filename) data = fname.read() self.textEdit.setText(data) fname.close() </code></pre> <p>However, this is the error I get:</p> <pre><code>Traceback (most recent call last): File "C:\Users\Kevin\Desktop\python-tumblr-0.1\antearaGUI.py", line 88, in browse filename = QtGui.QFileDialog.getOpenFileName(self, 'Open File', '.') TypeError: QFileDialog.getOpenFileName(QWidget parent=None, QString caption=QString(), QString directory=QString(), QString filter=QString(), QString selectedFilter=None, QFileDialog.Options options=0): argument 1 has unexpected type 'Ui_mainWindow' </code></pre> <p>So, ui_mainWindow is the class that all of my GUI buttons and the GUI itself is stored in.</p> <pre><code>class Ui_mainWindow(object): </code></pre> <p>I don't understand why I'm getting an error, does anyone have any ideas?</p> <p>Here is a pastebin link to the entire GUI: <a href="http://pastebin.com/BWCcXxUW" rel="nofollow">http://pastebin.com/BWCcXxUW</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload