File: frame.py

package info (click to toggle)
python-gtk2-tutorial 2.3-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,376 kB
  • ctags: 918
  • sloc: python: 5,731; makefile: 36
file content (46 lines) | stat: -rw-r--r-- 1,051 bytes parent folder | download | duplicates (3)
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
41
42
43
44
45
46
#!/usr/bin/env python

# example frame.py

import pygtk
pygtk.require('2.0')
import gtk

class FrameExample:
    def __init__(self):
        # Create a new window
        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        window.set_title("Frame Example")

        # Here we connect the "destroy" event to a signal handler 
        window.connect("destroy", lambda w: gtk.main_quit())
        window.set_size_request(300, 300)

        # Sets the border width of the window.
        window.set_border_width(10)

        # Create a Frame
        frame = gtk.Frame()
        window.add(frame)

        # Set the frame's label
        frame.set_label("GTK Frame Widget")

        # Align the label at the right of the frame
        frame.set_label_align(1.0, 0.0)

        # Set the style of the frame
        frame.set_shadow_type(gtk.SHADOW_ETCHED_OUT)
        frame.show()
  
        # Display the window
        window.show()

def main():
    # Enter the event loop
    gtk.main()
    return 0

if __name__ == "__main__":
    FrameExample()
    main()