0

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.next = 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.

1 Answer 1

0

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 http://www.pygtk.org/docs/pygtk/class-gtklabel.html for the label if the set_text does not work.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .