QFileDialog: unbounded method (Dummheitsfehler)
Verfasst: Freitag 4. Juni 2010, 12:15
Hi
Ich hab irgendwie Probleme mit QFileDialog selbst wenn ich 1:1 die Doku befolge...
Code Schnipsel 1:
Hier brucht der Code bei "mount.setFileMode()" ab mit der Meldung:
Code Schnipsel 2:
Hier bricht der Code bei "mount.exec_()" ab mit der Meldung:
Kann mir jemand sagen wo der Fehler ist, denn ich finde ihn nicht und in C++ funktioniert das ganze Problemlos.
Es wird auch so in der Doku beschrieben...
http://doc.qt.nokia.com/4.6/qfiledialog.html#details
http://www.riverbankcomputing.co.uk/sta ... ml#details
Ich hab irgendwie Probleme mit QFileDialog selbst wenn ich 1:1 die Doku befolge...
Code Schnipsel 1:
Code: Alles auswählen
def openSelectMount(self):
mount = QtGui.QFileDialog
print "Funzt?"
mount.setFileMode(QtGui.QFileDialog.ExistingFile)
if mount.exec_():
filename = mount.selectedFiles()
print filename
Code: Alles auswählen
Traceback (most recent call last):
File "/media/USB/KCrypt/Python/GUI/mount.py", line 20, in openSelectMount
mount.setFileMode(QtGui.QFileDialog.ExistingFile)
TypeError: QFileDialog.setFileMode(QFileDialog.FileMode): first argument of unbound method must have type 'QFileDialog'
Code Schnipsel 2:
Code: Alles auswählen
def openSelectMount(self):
mount = QtGui.QFileDialog
mount.FileMode(1)
if mount.exec_():
filename = mount.selectedFiles()
print filename
Code: Alles auswählen
Traceback (most recent call last):
File "/media/USB/KCrypt/Python/GUI/mount.py", line 21, in openSelectMount
if mount.exec_():
TypeError: QDialog.exec_(): first argument of unbound method must have type 'QDialog'
Kann mir jemand sagen wo der Fehler ist, denn ich finde ihn nicht und in C++ funktioniert das ganze Problemlos.
Es wird auch so in der Doku beschrieben...
http://doc.qt.nokia.com/4.6/qfiledialog.html#details
http://www.riverbankcomputing.co.uk/sta ... ml#details