赞
踩
- import tkinter;
-
- if __name__ == '__main__':
- from tkinter import *
-
- root = Tk()
- root.title('Canvas')
- canvas = Canvas(root, width=400, height=400, bg='yellow')
- x0 = 200
- y0 = 200
- y1 = 200
- x1 = 200
- for i in range(5):
- canvas.create_rectangle(x0, y0, x1, y1)
- canvas.create_oval(x0, y0, x1, y1)
- x0 -= 10
- y0 -= 10
- x1 += 10
- y1 += 10
-
- canvas.pack()
- root.mainloop()
这里需要导入tkinter模块,这个模块无需安装,已经自带了。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。