Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/test_pack.py
blob: 4cfccf78bb9ed737c9a97532e13b83bda1cbf3b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import gtk

def main():
    win = gtk.Window()
    win.connect('destroy', gtk.main_quit)
    win.set_default_size(850, 550)

    scroll = gtk.ScrolledWindow()
    scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
    viewport = gtk.Viewport()
    vbox = gtk.VBox()

    label_space = 30

    label = gtk.Label(
        "Sugar is the graphical user interface that you are looking at. "
          "It is a learning environment designed for children.")
    label.set_line_wrap(True)
    label.set_justify(gtk.JUSTIFY_FILL)
    label.set_width_chars(80)

    eb = gtk.EventBox()
    eb.add(label)
    eb.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("blue"))

    hbox = gtk.HBox(homogeneous=True, spacing=label_space)
    hbox.pack_start(eb, True, True,padding=50)
    vbox.pack_start(hbox, False)

    win.add(scroll)
    scroll.add(viewport)
    viewport.add(vbox)

    label.show()

    win.show_all()
    gtk.main()

if __name__ == '__main__':
    main()