First knowledge of Tkinter

Source: Internet
Author: User
Tags in python

Python offers several options for writing graphical interface programs, including Wxpython, Tkinter, and Qt. Each has its advantages and disadvantages, so Python does not choose one as the standard. Tkinter is a relatively easy to start GUI component.

Let's take a look at the first Python GUI program

From Swampy. Gui Import *

def makelabel ():
    g.la (Text = ' Thank you. ')

Def drawcircle ():
    canvas.config (bg = ' green ')
    item = Canvas.circle ([0, 0], fill = ' red ')
    item.config ( Fill = ' yellow ', outline = ' orange ', width = ten)
 
g = Gui ()
g.title (' GUI ')

canvas = g.ca (width = +, height =
Canvas.rectangle ([[0, 0], [MB]], fill = ' blue ', outline = ' orange ', width = ten)
canvas.line ([[0, 100], [Canvas.polygon], [+]], width = ten) ([[0, M], [M, M], [+]
], width = ten)
button = G. Bu (text = ' Draw Circle ', command = drawcircle)
g.mainloop ()

Experience:

The canvas canvas is a very handy control, both in Python and in the front-end technology. In fact, Tkinter is no good summary, through the inadvertently inserted Liu's exercise to draw out the interface, I would like to have the following points to summarize:

1, color collocation, this interface looks more bright and bright color, color, color psychology can be studied

2, the decomposition and synthesis of graphics, complex graphics are also composed of lines, the complex graphics are decomposed, and then implemented, and then combined to get complex graphics, such as drawing a blackboard, painting a blackboard sassafras and so on

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.