Kivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications.
Ellipse is a vertex canvas instruction. It allows drawing of a regular polygon, or an arc based on them. In this article, we will see different polygons have different number of sides and also many vertices on circle.
As in Kivy, we can make polygons based on an ellipse. Note, the angles in Kivy, are different than those in math. In Kivy, the 0-degree point, corresponds to the 90 degree-point, in math.
These are the formulas for x and y. These math formulas assume the center is 0, 0. Thus, after calculations are done, there has to be a translation by x of a and y of b. The width is 2a, and height is 2b.
N segments = N vertices
1) angle[i]= i*360/n ; i=0 to n
2) x[i]=a cos(angle[i])
3) y[i]=b sin(angle[i])
4) In kivy 12’o clock is 0 degree and increases clockwise but in math 3’o clock is 0 degree increases counter clockwise.
Program to show how we can make different polygon in kivy by Ellipse.
This is the result. We have 3 rows and 4 columns. Rows 2 and 3 are arc shapes, while Row1 has the default angles, 0 and 360 to form a complete circle. By changing the size of the window manually, we can get ovals, and shapes based on them. For the arc, the number of segments, corresponds to the number of lines that approximate the circular portion.
- Python | Detect Polygons in an Image using OpenCV
- Python OpenCV | cv2.ellipse() method
- Python PIL | ImageDraw.Draw.ellipse()
- Python| AnchorLayout in Kivy
- Python | Canvas in kivy
- Python | PageLayout in Kivy
- Python | StackLayout in Kivy
- Python | Bubble in kivy
- Python | Scatter in kivy
- Python | Animation in Kivy
- Python | Accordion in kivy
- GridLayouts in Kivy | Python
- Python | Kivy .kv File
- Python | How to use Multiple kv files in kivy
- Python | ScreenManager in Kivy using .kv file
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.