The simplest graphical programming of Python

Source: Internet
Author: User

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

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.