usr bin env python coding utf8 import gtk pygtk pygtk require class He

 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
#!/usr/bin/env python
#-*- coding: utf8 -*-
import gtk, pygtk
pygtk.require('2.0')
class HelloWorld2:
def __init__(self):
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.set_title("Прэвэд, кнопачэги!")
self.window.connect("delete_event", self.delete_event)
self.window.set_default_size(200, 50)
self.table = gtk.Table(2, 2)
self.window.add(self.table)
self.button1 = gtk.Button("Кинопко адын")
self.button1.connect("clicked", self.callback, "адын-адын")
self.button2 = gtk.Button("Кинопко дыва")
self.button2.connect("clicked", self.callback, "дыва-дыва")
self.table.attach(self.button1, 0, 1, 0, 1)
self.table.attach(self.button2, 1, 2, 1, 2)
self.window.show_all()
def callback(self, widget, data):
print "Прывэд, гындэлык - %s удавиле" % data
def delete_event(self, widget, event, data=None):
print "Минэ убиваюд, памагиде!!"
gtk.main_quit()
return False
def main(self):
gtk.main()
hello = HelloWorld2()
hello.main()