PyQt issue

Diez B. Roggisch deets at nospam.web.de
Fri Mar 3 14:03:51 EST 2006


dmbkiwi at gmail.com schrieb:
> 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



More information about the Python-list mailing list