- ·上一篇文章:查找字符串。
- ·下一篇文章:利用ellipse 和 rectangle 画图。。
画椭圆。
使用 Tkinter。
#!/usr/bin/python
# -*- coding:
UTF-8 -*-if __name__ == '__main__':
from Tkinter import *x = 360y = 160top = y - 30bottom = y - 30canvas = Canvas(width = 400,height = 600,bg = 'white')for i in range(20):
canvas.create_oval(250 - top,250 - bottom,250 + top,250 + bottom)top -= 5bottom += 5canvas.pack()mainloop()
程序源代码:
实例
#!/usr/bin/python
# -*- coding:
UTF-8 -*-if __name__ == '__main__':
from Tkinter import *x = 360y = 160top = y - 30bottom = y - 30canvas = Canvas(width = 400,height = 600,bg = 'white')for i in range(20):
canvas.create_oval(250 - top,250 - bottom,250 + top,250 + bottom)top -= 5bottom += 5canvas.pack()mainloop()
以上实例输出结果为:
画椭圆。
点我分享笔记