Gtkhello. py for small program development in PyGtk In Ubuntu (figure)

Source: Internet
Author: User
There are too many interesting and beautiful small programs in Ubuntu. I really want to know how the talented programmers do it, so I want to learn how to develop the linux interface program. The campus network is terrible when accessing foreign websites. Fortunately, the students used Netcom to access the Internet. They first went to some tutorials and materials and tried to compile a helloworld applet. As expected, errors are inevitable! By using the dir (gtk) lookup function and adding a bit of speculation, I changed the example and finally understood the examples.

There are too many interesting and beautiful small programs in Ubuntu. I really want to know how the talented programmers do it, so I want to learn how to develop the linux interface program.
The campus network was terrible when accessing foreign websites. Fortunately, the students used Netcom to access the Internet. They first went to some tutorials and materials and tried to compile a hello world applet. As expected, errors are inevitable! After using the dir (gtk) lookup function and a bit of speculation, I changed the example. Finally, I realized that those examples were from the old gtk version, currently, the function names in version 2.0 have changed many times.

Gtkhello. py

From gtk import * # importing all the widgets from gtk

Window = Window (WINDOW_TOPLEVEL) # create a top level window
Window. connect ("destroy", main_quit) # quit the event loop on destruction
Window. set_border_width (10) # set padding round child widget

Button = Button ("Hello World") # A button with the "Hello World" label
Window. add (button) # add button to window

Window. show_all () # Show the window with his widgets
Main () # enter the main event loop

Related Article

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.