您的位置:首页 > 编程语言 > Python开发

python基础练习--利用Tkinter画椭圆

2018-01-22 11:31 363 查看
首先在ubuntu下安装Tkinter包

转载:http://blog.csdn.net/ajieyxw/article/details/46489845

sudo apt-get install python-tk

sudo apt-get install python-imaging-tk

sudo apt-get install python-pip

sudo pip install requests

程序为:

1 # -*- coding:utf-8 -*-
2 if __name__ == '__main__':
3 from Tkinter import *
4 x = 360
5 y = 160
6 top = y - 30
7 bottom = y - 30
8 canvas = Canvas(width = 400,height = 600,bg = 'white')
9 for i in range(20):
10 canvas.create_oval(250 - top,250 - bottom,250 + top,250 + bottom)
11 top -= 5
12 bottom += 5
13 canvas.pack()
14 mainloop()

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: