Use Python for image programming, to use the graphics library. The graphics library can be obtained from http://mcsp.wartburg.edu/zelle/python/graphics.py. Save the downloaded graphics.py on the Windows platform in C:\Python31\Lib\site-packages.
The following code shows how to draw points, draw lines, draw circles, draw rectangles, draw ellipses, and display text.
From graphics import * #设置画布窗口名和尺寸win = Graphwin (' CSSA ', ' Max, ') #画点pt = point (+), Pt.draw (win) #画圆cir = Circle (point (Cir.draw), Cir.setoutline (' Red ') #外围轮廓颜色cir. Setfill (' yellow ') #填充颜色 # Draw line = lines (point (650, 100), Point (+)) Line.draw (win) #画矩形rect = Rectangle (point (+), point (+)) Rect.setfill (' Red ') # Fill Color Rect.draw (win) #画椭圆oval = Oval (Point (), point (at (), point (+)) Oval.setfill (' Red ') #填充颜色oval. Draw (Win) # Display text message = text (Point (Win.getwidth ()/2, +), ' Click anywhere to quit. ') Message.draw (Win) #关闭画布窗口win. Getmouse () Win.close ()
The simplest graphical programming of Python