Deepin Linux Desktop, screenshot tool Analysis (ii) GTK Pygtk__linux

Source: Internet
Author: User
Tags gtk

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 ()


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.