I use Python 3+PyGObjects+Gtk.Builder I have some window, what I create from glade:
builder = Gtk.Builder()
builder.add_from_file("main.ui")
I create some widgets and add them(i see it in window):
switch = Gtk.Switch()
switch.set_name('test')
hBox = Gtk.HBox()
hBox.pack_start(switch, True, True, 10)
window = builder.get_object("MainWindow")
window.add(hBox)
At another part of program I do not have access to "switch", but have to "builder". I try:
switch = builder.get_object('test')
switch_active = switch.get_active()
But receive error:
AttributeError: 'NoneType' object has no attribute 'get_active'
How I can get it from "builder"?