PyQt issue

D

dmbkiwi

I'm trying to write a simple dialog with PyQt. Ive got this code as
one of the slots:

def setFixed(self):
if len(str(self.fixed_label.displayText())) == 0:
QMessageBox.critical(self, "Label Missing", "You must enter
a label.")
else:
print str(self.fixed_date_month.currentText())
print str(self.fixed_date_day.currentText())
day_text = str(self.fixed_date_day.curentText()) + ' ' +
str(self.fixed_date_month.currentText())
self.date_list.insertItem(date_text)

self.label_list.insertItem(str(self.fixed_label.displayText()))

When run, the output is:

January
1
Traceback (most recent call last):
File "/home/matt/karamba/date_calc/date_config.py", line 285, in
setFixed
day_text = str(self.fixed_date_day.curentText()) + ' ' +
str(self.fixed_date_month.currentText())
AttributeError: curentText

How can it print .currentText(), but then throw an AttributeError when
I try an put them in a variable?

Any help appreciated.

Cheers

Matt
 
P

Phil Thompson

I'm trying to write a simple dialog with PyQt. Ive got this code as
one of the slots:

def setFixed(self):
if len(str(self.fixed_label.displayText())) == 0:
QMessageBox.critical(self, "Label Missing", "You must enter
a label.")
else:
print str(self.fixed_date_month.currentText())
print str(self.fixed_date_day.currentText())
day_text = str(self.fixed_date_day.curentText()) + ' ' +
str(self.fixed_date_month.currentText())
self.date_list.insertItem(date_text)

self.label_list.insertItem(str(self.fixed_label.displayText()))

When run, the output is:

January
1
Traceback (most recent call last):
File "/home/matt/karamba/date_calc/date_config.py", line 285, in
setFixed
day_text = str(self.fixed_date_day.curentText()) + ' ' +
str(self.fixed_date_month.currentText())
AttributeError: curentText

How can it print .currentText(), but then throw an AttributeError when
I try an put them in a variable?

Any help appreciated.

Look at the error message more closely - that should "cure" it. Then slap your
forehead.

Phil
 
D

Diez B. Roggisch

I'm trying to write a simple dialog with PyQt. Ive got this code as
one of the slots:

def setFixed(self):
if len(str(self.fixed_label.displayText())) == 0:
QMessageBox.critical(self, "Label Missing", "You must enter
a label.")
else:
print str(self.fixed_date_month.currentText())
print str(self.fixed_date_day.currentText())
day_text = str(self.fixed_date_day.curentText()) + ' ' +
str(self.fixed_date_month.currentText())
self.date_list.insertItem(date_text)

self.label_list.insertItem(str(self.fixed_label.displayText()))

When run, the output is:

January
1
Traceback (most recent call last):
File "/home/matt/karamba/date_calc/date_config.py", line 285, in
setFixed
day_text = str(self.fixed_date_day.curentText()) + ' ' +
str(self.fixed_date_month.currentText())
AttributeError: curentText

How can it print .currentText(), but then throw an AttributeError when
I try an put them in a variable?

Because you wrote curentText - note the missing t. Which the error-message clearly says. I suggest you acquaint yourself
with pylint & pychecker.

Diez
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top