PyQt issue

Phil Thompson phil at riverbankcomputing.co.uk
Fri Mar 3 13:49:05 EST 2006


On Friday 03 March 2006 6:39 pm, dmbkiwi at gmail.com wrote:
> 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



More information about the Python-list mailing list