What is Python GUI programming (Tkinter)? Example Show Python tkinter tutorial

Source: Internet
Author: User
Tags tkinter tutorial
The previous article we learned about Python CGI programming, this article we will introduce Python GUI Programming (Tkinter)and attached Python tkinter Tutorial.
Python provides a library of multiple graphical development interfaces, several common Python GUI libraries are as follows:

Tkinter: The Tkinter module (TK interface) is the interface for Python's standard Tk GUI toolkit. Tk and Tkinter can be used on most Unix platforms and can also be applied to Windows and Macintosh systems. Subsequent versions of Tk8.0 can be implemented in a native window style and run well on most platforms.

Wxpython:wxpython is an open source software, a good set of GUI graphics libraries in the Python language, allowing Python programmers to easily create a complete, functional GUI user interface.

The Jython:jython program can be seamlessly integrated with Java. In addition to some standard modules, Jython uses Java modules. Jython has almost all the modules in the standard Python that do not depend on the C language. For example, Jython's user interface will use SWING,AWT or SWT. Jython can be dynamically or statically compiled into Java bytecode.

Tkinter programming

Tkinter is the standard GUI library for Python. Python uses Tkinter to quickly create GUI applications.

Since Tkinter is built into Python's installation package, as long as Python is installed to import the Tkinter library, and IDLE is also written in Tkinter, for a simple graphical interface Tkinter can handle it.

Import Tkinter

Create a GUI program

1. Import Tkinter Module

2. Create a control

3. Specify the master of this control, that is, which one of the controls belongs to

4. Tell GM (geometry Manager) that a control has been generated.

#!/usr/bin/python#-*-coding:utf-8-*-import tkintertop = tkinter.tk () # Enter message loop Top.mainloop ()

The above code executes results such as:

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.