Skip to content

Commit aab32e3

Browse files
danielquinnsebp
authored andcommitted
Fix typo and re-order creation
There was a typo in `super()` and in fixing that I thought it a good idea to re-order this file to be a little more linear: creating objects and adding them to other objects, rather than creating objects, adding them, and then mutating them after they've been added.
1 parent 702d924 commit aab32e3

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

examples/layout_grid_example.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@
66

77
class GridWindow(Gtk.Window):
88
def __init__(self):
9-
sper().__init__(title="Grid Example")
109

11-
grid = Gtk.Grid()
12-
self.add(grid)
10+
super().__init__(title="Grid Example")
1311

1412
button1 = Gtk.Button(label="Button 1")
1513
button2 = Gtk.Button(label="Button 2")
@@ -18,13 +16,16 @@ def __init__(self):
1816
button5 = Gtk.Button(label="Button 5")
1917
button6 = Gtk.Button(label="Button 6")
2018

19+
grid = Gtk.Grid()
2120
grid.add(button1)
2221
grid.attach(button2, 1, 0, 2, 1)
2322
grid.attach_next_to(button3, button1, Gtk.PositionType.BOTTOM, 1, 2)
2423
grid.attach_next_to(button4, button3, Gtk.PositionType.RIGHT, 2, 1)
2524
grid.attach(button5, 1, 2, 1, 1)
2625
grid.attach_next_to(button6, button5, Gtk.PositionType.RIGHT, 1, 1)
2726

27+
self.add(grid)
28+
2829

2930
win = GridWindow()
3031
win.connect("destroy", Gtk.main_quit)

0 commit comments

Comments
 (0)