1. Tkinter
Import Tkinter:from tkinter Import *
Create window: TK=TK ()
Repaint window: Tk.update ()
Refresh. Tk.update_idletasks ()
Create button: Btn=button (tk, Text = ' button info ', command= function)
Create canvas (from left to right, top to bottom): Canvas=canvas (tk,width= wide, height= High)
Draw line: Canvas.create_line (beginning x, beginning Y, end x, end y)
Picture box: Canvas.create_rectangle (Start x, start Y, end x, end y[,fill= color), color rgb (' #xxxxxx ' #表明是16进制, each two-bit color)
Draw Arc: Canvas.create_arc (beginning x, beginning Y, endpoint x, endpoint y,extent= angle, STYLE=ARC)
Draw Polygon: Canvas.create_polygon (1x, Dot 1y, dot 1x, Dot 1y ...) [, Fill= ""])
Display text: Canvas.create_text (x,y,text= ' text ' (' font ', size)]
Display Picture: Myimage=photoimage (file= ' Full name of file ')
Canvas.create_image (x,y,anchor= direction, image=myimage)
Objects to move the canvas: Canvas.move (Object id,x,y)
Monitoring events, available event, such as: Def Moveobject (event):
Statement block
if Event.keysym = = ' Key Name ':
Operation or processing
Call the specified function when a specific event occurs: Canvas.bind_all (' <keypress-key > ', function), key name such as: Return, up, down, left, right change the properties of the object: Canv As.itemconfig (object id, attribute = ' value '), such as: fill= ' Blue ', outline= ' red ' gets the position of the object: Canvas.coords (Object ID)
Display: Pack (), Btn.pack (), Canvas.pack ()
Color Picker: Colorchooser.askcolor () [1]
Turtle Mapping Addendum:
Create canvas: Turtle.setup (width= wide, height= High)
To a coordinate: T.goto (x,y), x,y can use a negative number
2. Named parameters, that is, when the function is called, specify the parameter name, you can make the parameters are not in order to fill.