I'm trying to create widgets with a loop. This is what I tried :
def set_runways(self, airfield):
i = 0
for rwy in airfield['Runways']:
frame = Gtk.Frame()
frame.set_label('-'.join([rwy['Runway_1'], rwy['Runway_2']]))
frame.set_shadow_type(1)
self.runways_layout.attach(frame, (i / 2), (i % 2), 1, 1)
rwy_layout = Gtk.Grid()
frame.add(rwy_layout)
# Just for testing :
label = Gtk.Label('Hello, World')
rwy_layout.attach(label, 0, 0, 1, 1)
I import my runways_layout
in my __init__
with self.runways_layout = builder.get_object('runwaysGrid')
which is a Gtk.Grid
and I call my function after with self.set_runways(airfield)
. But even with this, my window doesn't show Hello World
, I have a blank window... Why ?
I specify that my rwy
isn't empty.
Thanks for your help.
EDIT :
Okay I tried this simple thing :
self.runways_layout = builder.get_object('runwaysGrid')
label = Gtk.Label('Coucou')
self.runways_layout.attach(label, 0, 0, 1, 1)
And it doesn't work too... O_o