开发者

QLabel.setText() not working?

开发者 https://www.devze.com 2023-04-04 15:36 出处:网络
I have been trying to get QLabel.setText in PySide working for several days, but no succes. I have following code(simplified):

I have been trying to get QLabel.setText in PySide working for several days, but no succes.

I have following code(simplified):

def GUI(self):
    self.data1=QtGui.QLabel()
    self.data2=QtGui.QLCDNumber()
    self.lcdTimer=QtGui.QLCDNumber()

def tick(time, self):
    self.lcdTimer.display(timetodisplay)  ## this one works
    self.data1.setText(somdatafromlist1)  ## this one not
    self.data2.display(somedatafromlist2) ## this one not

So, why I get an errors like this:

self.data2.disp开发者_如何学运维lay(somedatafromlist2)
AttributeError: 'PySide.QtGui.QImage' object has no attribute 'display'
self.data1.setText(somedatafromlist1)
TypeError: setText expected 2 arguments, got 1

And why is lcdTimer.display() working, but the other ones not. What is the second argument .setText neededs?

The problem should not be in the somedatafromlist1 or somedatafromlist2.

I have tried to check out that self.lcdTimer and self.data2 are almost identical.


Get it working. Problem was that I had also other objects(ImageQt) a few hundreds lines later with names self.data1 and self.data2. def tick(time, self): was actually def tick(self, time):in my code.

0

精彩评论

暂无评论...
验证码 换一张
取 消