本文摘自php中文网,作者Tomorin,侵删。
本章我们来介绍用ellipse和rectangle画图,并且在例子中介绍rectangle是什么意思:Rectangle是一个函数,使用该函数画一个矩形,可以用当前的画笔画矩形轮廓,用当前画刷进行填充。什么是rectangle:
rectangle是存储一组整数,共四个,表示一个矩形的位置和大小
语法:
1 2 3 4 | [SerializableAttribute]
[TypeConverterAttribute( typeof (RectangleConverter))]
[ComVisibleAttribute( true )]
public struct Rectangle
|
程序源代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #!/usr/bin/python# -*- coding: UTF-8 -*-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()
|
以上实例输出结果为:

以上就是rectangle是什么意思,如何利用elipse和rectangle画图的详细内容,更多文章请关注木庄网络博客!!
相关阅读 >>
Python求n的阶乘
Python怎么调用youget
Python如何实现客户端和服务器端的数据传输(代码)
Python中一些常用的运算符和内置函数
怎样在Python求和
Python是什么语言写的?
地理位置geo处理之mysql函数的详细介绍(附代码)
Python 统计字数的思路详解
Python中的切片是什么?(实例解析)
Python数据结构与算法之常见的分配排序法示例【桶排序与基数排序】_Python
更多相关阅读请进入《Python》频道 >>
人民邮电出版社
python入门书籍,非常畅销,超高好评,python官方公认好书。
转载请注明出处:木庄网络博客 » rectangle是什么意思,如何利用elipse和rectangle画图