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