Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying to add a text Combo Box into my app. I've created in and populated the list but when I I try to print out the active text I get an error.

Here's the part of the code in question:

    def on_netif_changed(self, widget):
    netif = widget.gtk_combo_box_text_get_active_text()
    print netif

And the error I get:

Traceback (most recent call last):
File "/home/boywithaxe/Developer/Quickly/broadcast/broadcast/BroadcastWindow.py", line 44, in on_netif_changed
netif = widget.gtk_combo_box_text_get_active_text()
AttributeError: 'ComboBoxText' object has no attribute 'gtk_combo_box_text_get_active_text'

I'm a bit at a loss here, I've no problem betting text from text boxes, but this seems a completely different issue. I tried RTFMing but came up short. I would appreciate any suggestions.

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

The method name is "get_active_text" not "gtk_widget_get_active_text" (that is the name of the C function), i.e. you should do:

def on_netif_changed(self, widget):
    netif = widget.get_active_text()
    print netif
share|improve this answer
    
Thank you, that did it! –  boywithaxe Jun 21 '12 at 22:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.