Reputation: 607
I am making an application that takes input from a gyroscope and accelerometer and displays that information in the GUI. How can I display this dynamic information with glade? Is there a way to have a label reflect a variable in my code? I am using python.
Upvotes: 1
Views: 1455
Reputation: 4114
To display data on a Gtk.Label defined on a glade file you must, load the glade file with Gtk.Builder:
builder = Gtk.Builder()
builder.add_from_file("your_file.glade")
Then retrieve the label, with the given ID (the widget name you gave to the label, let suppose it was label1):
label = builder.get_object("label1")
From then on, you can use label.set_text
or label.set_markup
methods to update the label.
This info applies to Gtk3 and PyGObject.
Upvotes: 2