Python Tkinter canvas oval原理

本文介绍了使用坐标绘制椭圆的数学原理与方法,通过定义矩形的两个顶点坐标来绘制唯一内切椭圆,并提供了图形填充、边框颜色等选项的详细说明。

Ovals, mathematically, are ellipses, including circles as a special case. The ellipse is fit into a rectangle defined by the coordinates (x0, y0) of the top left corner and the coordinates (x1, y1) of the bottom right corner:

 

The oval will coincide with the top and left-hand lines of this box, but will fit just inside the bottom and right-hand sides.

To create an ellipse on a canvas C, use:

    id = C.create_oval ( x0, y0, x1, y1, option, ... )

which returns the object ID of the new oval object on canvas C.

Options for ovals:

fill

The default appearance of ellipse is transparent, and a value of fill="" will select this behavior. You can also set this option to any color and the interior of the ellipse will be filled with that color; see Section 4.3, “Colors”.

outline

The color of the border around the outside of the ellipse. Default is outline="black".

stipple

A bitmap indicating how the interior of the ellipse will be stippled. Default is stipple="", which means a solid color. A typical value would be stipple="gray25". Has no effect unless the fill has been set to some color. See Section 4.7, “Bitmaps”.

tags

The tags to be associated with the object, as a sequence of strings. See Section 6.1.4, “Canvas tags”.

width

Width of the border around the outside of the ellipse. Default is 1 pixel; see Section 4.1, “Dimensions” for possible values. If you set this to zero, the border will not appear. If you set this to zero and make the fill transparent, you can make the entire oval disappear.

 

 

其实,是刚知道画椭圆的主要原理,根据两点确定的矩形,然后画一个唯一的内切的椭圆。也就是实现了两点确定一个椭圆。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值