This chapter mainly revolves around Deepin screenshot tool to refer to module to slowly learn it, the basic technology concept decides superstructure, hope not to be sprayed.
PYGTK is the deepin used to build a GUI this is the basic tool, said that the building is not the foundation of the strange, screenshots are the window is this dongdong built.
PYGTK is one of the most commonly used modules, as follows:
Http://www.pygtk.org/pygtk2tutorial/index.html
#!/usr/bin/env python #example pygtk_test.py import pygtk pygtk.require (' 2.0 ') Import GTK class Base:def destroy (S ELF): ' Destroy window ' gtk.main_quit () def hello (self, widget, data): ' Print some data '
' Print ' Hello ' + data + ' This is a button click () Test ' Def delete_event (self, widget, event, Data=none): Print "Delete event occurred" return False def __init__ (self): Self.window = gtk. Window (GTK. Window_toplevel) Self.window.connect ("Delete_event", self.delete_event) Handler1 = Self.window.connect ("de
Stroy ", Self.destroy) print" Handler1 is:%d "% handler1 self.window.set_title (" PyGTK Test window ") Self.window.set_default_size (self.window.set_border_width) self.window.set_position (GTK. Win_pos_center) Self.button1 = GTK. Button () Self.button2 = GTK. Button () Self.button1.set_label (' Label1 ') self.button2.seT_label (' Label2 ') Handler2 = Self.button1.connect ("Clicked", Self.hello, "PyGTK") print "Handler2 is:%d"% Handler2 self.button1.connect_object ("clicked", Gtk. Widget.destroy, Self.window) self.button1.disconnect (handler2) Self.box1 = GTK. Hbox (False, 0) self.window.add (self.box1) Self.box1.pack_start (Self.button1, True, True, 0) self.b Utton1.show () Self.box1.pack_start (Self.button2, True, True, 0) self.button2.show () self.box1.show () Self.window.show () def main (self): Gtk.main () print __name__ if __name__ = = "__main__": Ba SE = Base () base.main ()