本程序只是为了测试自己编写的rect模块里面的scale方法.。
""" 矩形缩放测试程序.py """ import time from rect import * from tkinter import * root = Tk() root.title('矩形缩放测试程序www.lixingqiu.com') cv = Canvas(width=480,height=360,bg='cyan') cv.pack() def demo(event): k = 5 while k>0.1: r1.scale(k) cv.create_rectangle(r1.left,r1.top, r1.right,r1.bottom) k = k - 0.2 cv.update() time.sleep(0.1) cv.create_rectangle(r1.raw_left,r1.raw_top, r1.raw_right,r1.raw_bottom,fill='red') # 实例化,左上角坐标(200,140),宽80,高40 r1 = Rect(200,140,80,40) # 创建矩形对象 cv.bind("",demo) root.mainloop()
发表评论