python的graphics库的简单用法
来源:互联网 发布:关于网络诈骗新闻 编辑:程序博客网 时间:2024/06/05 20:14
from graphics import *
#设置画布窗口名和尺寸
win = GraphWin('CSSA', 700, 700)
#画点
pt = Point(100, 100)
pt.draw(win)
#画圆
cir = Circle(Point(200, 200), 75)
cir.draw(win)
cir.setOutline('red') #外围轮廓颜色
cir.setFill('yellow') #填充颜色
#画线
line = Line(Point(650, 100), Point(250, 100))
line.draw(win)
#画矩形
rect = Rectangle(Point(300, 300), Point(400, 400))
rect.setFill('red') #填充颜色
rect.draw(win)
#画椭圆
oval = Oval(Point(450, 450), Point(600, 600))
oval.setFill('red') #填充颜色
oval.draw(win)
#显示文字
message = Text(Point(win.getWidth()/2, 20), 'Click anywhere to quit.')
message.draw(win)
#关闭画布窗口
win.getMouse()
win.close()
#设置画布窗口名和尺寸
win = GraphWin('CSSA', 700, 700)
#画点
pt = Point(100, 100)
pt.draw(win)
#画圆
cir = Circle(Point(200, 200), 75)
cir.draw(win)
cir.setOutline('red') #外围轮廓颜色
cir.setFill('yellow') #填充颜色
#画线
line = Line(Point(650, 100), Point(250, 100))
line.draw(win)
#画矩形
rect = Rectangle(Point(300, 300), Point(400, 400))
rect.setFill('red') #填充颜色
rect.draw(win)
#画椭圆
oval = Oval(Point(450, 450), Point(600, 600))
oval.setFill('red') #填充颜色
oval.draw(win)
#显示文字
message = Text(Point(win.getWidth()/2, 20), 'Click anywhere to quit.')
message.draw(win)
#关闭画布窗口
win.getMouse()
win.close()
阅读全文
0 0
- python的graphics库的简单用法
- [研讨] Shape、Sprite 和 MovieClip 对象的 graphics 属性(graphics类)的简单用法
- python sqlalchemy的简单用法
- python BeautifulSoup的简单用法
- python字典的简单用法
- python print的简单用法
- Graphics.DrawImage函数其中一种的用法
- python的threading的简单用法
- python的argv最简单的用法
- python sqlalchemy更简单的用法
- python爬虫--BeautifulSoup的简单用法
- python Tkinter Text的简单用法
- python dict的一些简单用法
- Python中join的简单用法
- python中装饰器的简单用法
- python range的最简单用法
- python 中 feedparser的简单用法
- opencv-python的一些简单用法
- editext 两次获取焦点 , 当设 etComment.setFocusable(false);后 还学要点击两次获取焦点
- 构建微服务:Spring Boot 从听说到精通 (一)
- std::thread库的condition_variable进行线程唤醒
- bootstrap模态框页面抖动和暗黑锁定处理
- Linux系统下普遍常用的命令(会陆续更新...)
- python的graphics库的简单用法
- HDU 3037(隔板法+组合数+Lucas)
- bug宝典Python篇 environment can only contain strings
- php常见术语
- 友盟分享QQ成功后 不回调app
- Hibernate的缓存纪要
- C程序设计语言练习1-23 编写一个删除C语言程序中所有的注释语句
- JVM OOM & JAVA finalizer 引发的OOM & Thread.stop
- 简述正则表达式的语法规则(二)