How to get access to widgets?

Asked by Alexander Telenga on 2009-02-10

Is there any manual or howto of this problem?
I've created glade file, parsed it with Gladex and got two .py files - main and callbacks. Now I need to write callbacks functions, but I can't understand how to get access to widgets.
For example I have 3 entry boxes, 1 combobox, 3 buttons in my glade file. I have in the callbacks file :

def on_SolveButton_clicked(widget, data, wtree):
   print "function 'on_on_SolveButton_clicked' not implemented"

In this function I want to get data from first two entries, math sign from combobox and calculate result. How can I do this?

Question information

English Edit question
Gladex Edit question
No assignee Edit question
Solved by:
Francesco Marella
Last query:
Last reply:

hi Alexander,

you can get access to the whole tree by using the parameter "wtree" like below:

def on_SolveButton_clicked(widget, data, wtree):
   #print "function 'on_on_SolveButton_clicked' not implemented"
   entry1 = wtree.get_widget("id_entry1")
   entry2 = wtree.get_widget("id_entry2")
now that you have the widgets you can call the proper methods (es. entry1.get_text() ).
See for more details.


Alexander Telenga (telenga) said : #2

Thanks Francesco Marella, that solved my question.