nerdoc
nerdoc

Reputation: 1083

PySide & Python3: TypeError on QAction

I'm puzzled. I run PySide with Python3 under Ubuntu 13.10. I can't get past a simple task where my testing suite gave an error; I narrowed down the problem to a two-liner:

from PySide.QtGui import QAction
a = QAction("Test")

This is it. If I just run these two lines directly in the /usr/bin/python3 interpreter (v3.3.2), it shouts at me:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'PySide.QtGui.QAction' called with wrong argument types:
  PySide.QtGui.QAction(str)
Supported signatures:
  PySide.QtGui.QAction(PySide.QtCore.QObject)
  PySide.QtGui.QAction(PySide.QtGui.QIcon, unicode, PySide.QtCore.QObject)
  PySide.QtGui.QAction(unicode, PySide.QtCore.QObject)

I don't really know what this should mean. I thought ALL (str) strings in Python3 are unicode. Qhy does PySide complain about not being implicitely the same type (str <=> unicode)?

Any help welcome, I am lost here.

Upvotes: 0

Views: 799

Answers (1)

nerdoc
nerdoc

Reputation: 1083

OMG, I did it again. 1min after posting to stackoverflow, i got the solution, after hours of frustrating work earlier ;-)

Solution is simple: it has nothing to do with the str - unicode conversion. QAction at least needs a text argument (str, bytes, unicode...) AND a parent (a QObject derivate) - I forgot this, just None is enough.

Upvotes: 3

Related Questions