美文网首页python学习笔记
python练手_64-画椭圆、矩形

python练手_64-画椭圆、矩形

作者: 学子CH | 来源:发表于2019-02-17 17:50 被阅读0次
# -*- coding:utf-8 -*-
# @Author: CH
"""
@project: python study
@time:2019/1/7-23:56
@file_name:【程序64】画椭圆、矩形.py
@IDE:PyCharm 
@else: DO NOT STOP STUDYING!!!
"""
# 题目 利用ellipse 和 rectangle 画图。。
#
# 程序分析 无。
if __name__ == '__main__':
    from tkinter import *
    canvas = Canvas(width = 400,height = 600,bg = 'white')
    left = 20
    right = 50
    top = 50
    num = 15
    for i in range(num):
        canvas.create_oval(250 - right,250 - left,250 + right,250 + left)
        canvas.create_oval(250 - 20,250 - top,250 + 20,250 + top)
        canvas.create_rectangle(20 - 2 * i,20 - 2 * i,10 * (i + 2),10 * ( i + 2))
        right += 5
        left += 5
        top += 10

    canvas.pack()
    mainloop()

相关文章

网友评论

    本文标题:python练手_64-画椭圆、矩形

    本文链接:https://www.haomeiwen.com/subject/qzameqtx.html