简体   繁体   English

如何从以下坐标绘制椭圆形?

[英]How would you draw a oval from the following coordinates?

I'm attempting to use the media module in python to draw an oval form these coordinates. 我试图在python中使用媒体模块绘制这些坐标的椭圆形。

(244,88) to (288,44) (244,88)至(288,44)

Here is what I have so far: 这是我到目前为止的内容:

import media
from color import *

z=media.create_picture(640, 400, white)
media.add_oval_filled(y, 288, 44, 44, 88, black)

media.show(z)

I know this is not right, but how could I make a circle from the coordinates stated above. 我知道这是不对的,但是我怎么能从上述坐标画一个圆。 This would produce a oval, that is slanted. 这将产生一个倾斜的椭圆形。 (Please only use the media module and color!) (请仅使用媒体模块和颜色!)

If you want to draw an ellipse from (244,88) to (288,44), your width and height should be 44 and 44 and not 44 and 88. So Try this 如果要绘制从(244,88)到(288,44)的椭圆,则宽度和高度应为44和44,而不是44和88。因此,请尝试此操作

z=media.create_picture(640, 400, white)
media.add_oval_filled(z, 244, 88, 44, 44, black)
media.show(z)

For drawing arcs use pygame module. 对于绘制弧,请使用pygame模块。

To draw a partial section of an ellipse, Use 要绘制椭圆的一部分,请使用

pygame.draw.arc(Surface, color, Rect, start_angle, stop_angle, width)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM