100-058

画图,学用rectangle画方形。
 1 #! /usr/bin/env python
 2 # -*- coding:utf-8 -*-
 3 '''
 4 画图,学用rectangle画方形。
 5 '''
 6 if __name__ == '__main__':
 7     from tkinter import *
 8 
 9     root = Tk()
10     root.title('Canvas')
11     canvas = Canvas(root, width=400, height=400, bg='blue')
12     x0 = 263
13     y0 = 263
14     y1 = 275
15     x1 = 275
16     for i in range(19):
17         canvas.create_rectangle(x0, y0, x1, y1)
18         x0 -= 5
19         y0 -= 5
20         x1 += 5
21         y1 += 5
22 
23     canvas.pack()
24     root.mainloop()

 

posted @ 2018-05-22 19:19  睡到自然醒的猪  阅读(91)  评论(0)    收藏  举报

xliaoe at 111 dot com ; 返回顶部