Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just need the code necessary to have my application assign the input from a text box to a variable after 'Enter' is pushed, and then use it to change a label.

This is what I have for this problem:

def on_action_activated(self): = self.action.get_text()  

And then for using it I'm doing:

info.set_text("Would you like to start a new game? (no saving yet, working on it...)")   

And it's not working for me. Now I'm doing all of this in several different functions, so would that be causing the problem, or is it just something else? I have created the local variable for both the label and the text box.

share|improve this question

I dont have access to the code I used to do it now, but if you have created your local variable for the text box, with the self.textbox = builder.get_object('glade texbox id') (or something like that), you should be able to do on_textbox_activated(self): self.variable = self.textbox.get_text(), with the "textbox" in "on_textbox_activated" being the name of your textbox widget without the self prefix. As for your label, I am pretty sure you can use set_text('text here'), so self.label.set_text(self.variable).

see for the label if the set_text does not work.

share|improve this answer

Your Answer


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.