[PyKDE] Canvas problems

Mark Kimsal chugadie.geo at yahoo.com
Mon Dec 11 23:27:13 GMT 2000


I am having problems working with QCanvas and QCanvasItem objects

ERROR:
Traceback (most recent call last):
  File "pytimes/main.py", line 6, in ?
    w = MainWindow()
  File "pytimes\mainWindow.py", line 81, in __init__
    self.scrollCanvas = ScrollCanvas(self)
  File "pytimes\mainWindow.py", line 29, in __init__
    text = ScrollText(this)
  File "pytimes\mainWindow.py", line 14, in __init__
    apply(QCanvasItem.__init__, (this,parent))
  File "c:\dev\python\lib\qt.py", line 172, in __init__
    libqtc.sipCallCtor(191,self,args)
TypeError: Invalid argument types to QCanvasItem()



CODE:
class ScrollCanvas(QCanvas):
 def __init__(this,parent):
  QCanvas.__init__(this,parent,'scrollFrame')
  this.resize(590,30)
  this.setBackgroundColor(Qt.black)
  text = QCanvasItem(this)
  text.show()
  this.startTimer(120)

If I change, in line 171 of qt.py, the number 191 to 190 I get the
following error

Traceback (most recent call last):
  File "pytimes/main.py", line 6, in ?
    w = MainWindow()
  File "pytimes\mainWindow.py", line 82, in __init__
    self.scrollCanvas = ScrollCanvas(self)
  File "pytimes\mainWindow.py", line 31, in __init__
    stext.show()
SystemError: NULL result without error in call_object

Is there any sample code for using QCanvasItems?





More information about the PyQt mailing list