public
Created

  • Download Gist
pyside_typeerror.py
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
from PySide import QtGui
from PySide.QtGui import QCheckBox,QGraphicsLayoutItem
import sys
 
class Editor(QGraphicsLayoutItem):
def __init__(self, name):
QGraphicsLayoutItem.__init__(self)
def update_value(self, value):
pass
 
class BooleanEditor(Editor, QCheckBox):
def __init__(self, value):
Editor.__init__(self, "foo")
QCheckBox.__init__(self)
 
self.update_value(value)
 
def update_value(self, value):
self.old_value = value
self.setCheckState(value) # Error occurs here. "value" will be boole
 
 
QtGui.QApplication(sys.argv)
BooleanEditor(True)
 
# Throws:
# ...
# File "pyside_typeerror.py", line 20, in update_value
# self.setCheckState(value) # Error occurs here. "value" will be boole
#TypeError: 'PySide.QtGui.QCheckBox.setCheckState' called with wrong argument types:
# PySide.QtGui.QCheckBox.setCheckState(bool)
#Supported signatures:
# PySide.QtGui.QCheckBox.setCheckState(PySide.QtCore.Qt.CheckState)
 
 
"""

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.