Draw an ellipse using Arcade library in Python
Last Updated :
11 Oct, 2020
Prerequisite: Arcade Library
The Arcade library is a modern Python Module used for developing 2D video games with enthralling graphics and sound. It is an object-oriented library. It can be installed like any other Python Package in your IDE.
Arcade Module has two inbuilt functions for drawing an ellipse i.e arcade.draw_ellipse_outline() and arcade.draw_ellipse_filled(). This is a plus point in the arcade module, otherwise, you must have noticed that in Python modules like turtle, you need to create a function for drawing any primitive design.
1) arcade.draw_ellipse_outline(): This method is used to outline of an ellipse.
Syntax: arcade.draw_ellipse_outline(centre_x, centre_y, width, height, color, border_width, tilt_angle, num_segments)
1. centre_x: x position that is the center of the ellipse.
2. centre_y: y position that is the center of the ellipse.
3. Width: Width of the ellipse.
4. Height: Height of the ellipse.
5. Color: This is used to define the colors used for making outline of the ellipse with the help of arcade.color function.
6. border_width: Width of the ellipse outline in pixels.
7. tilt_angle: Angle in degrees to tilt the ellipse.
8. num_segments: Number of triangle segments that make up this ellipse. The default value is -1 that clearly means that arcade will calculate amount of segments based on the size of the ellipse.
Implementation of the above method:
Python3
# Import required modules
import arcade
# Specify Parameters
SCREEN_WIDTH = 600
SCREEN_HEIGHT = 800
SCREEN_TITLE = "Welcome to GeeksForGeeks "
# Open the window
arcade.open_window(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
# Set the background color
arcade.set_background_color(arcade.color.BABY_BLUE)
# Start drawing
arcade.start_render()
# Draw ellipse
arcade.draw_ellipse_outline(
400, 363, 250, 130, arcade.color.AMBER, 10, 180, -1)
# Finish drawing
arcade.finish_render()
# Display everything
arcade.run()
Output:
2) arcade.draw_ellipse_filled(): This method is used to draw filled ellipse.
Syntax: arcade.draw_ellipse_filled(centre_x, centre_y, width, height, color, tilt_angle, num_segments)
1. centre_x: x position that is the center of the ellipse.
2. centre_y: y position that is the center of the ellipse.
3. Width: Width of the ellipse.
4. Height: Height of the ellipse.
5. Color: This is used to define the colors used for making outline of the ellipse with the help of arcade.color function.
6. border_width: Width of the ellipse outline in pixels.
7. tilt_angle: Angle in degrees to tilt the ellipse.
8. num_segments: Number of triangle segments that make up this ellipse. The default value is -1 that clearly means that arcade will calculate amount of segments based on the size of the ellipse.
All other parameters are same as arcade.draw_ellipse_outline() except the border_width. In arcade.draw_ellipse_filled() we don't require border_width.
Implementation of the above method:
Python3
# Import required modules
import arcade
# Specify Parameters
SCREEN_WIDTH = 600
SCREEN_HEIGHT = 800
SCREEN_TITLE = "Welcome to GeeksForGeeks "
# Open the window
arcade.open_window(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
# Set the background color
arcade.set_background_color(arcade.color.BABY_BLUE)
# start drawing
arcade.start_render()
# Draw ellipse
arcade.draw_ellipse_filled(400, 363, 250, 130, arcade.color.AMBER, 180, -1)
# Finish drawing
arcade.finish_render()
# Display everything
arcade.run()
Output:
Similar Reads
Draw a happy face using Arcade Library in Python Arcade is a Python module used for developing 2D games. For drawing a happy face, steps are as follows: Import arcade library.import arcade Open the window.arcade.open_window(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE) The function used with arcade is open_window. This command opens a window with a g
2 min read
Draw a tree using arcade library in Python Drawing a tree isn't a tough task in Python using the turtle module. But, what if you can draw it using Arcade Module as well. Arcade is an object-oriented library. It can be installed like any other Python Package using an import arcade. Approach: Import arcade.Define a function to draw trees. Here
3 min read
Draw a sun using arcade library Python You might have drawn Sun using famous Python module like turtle but here we discuss how the same approach can be achieved using arcade module. The Arcade library is a modern Python Module used widely for developing 2D video games with compelling graphics and sound. Arcade is an object-oriented libra
2 min read
Draw an arc using Arcade in Python The arcade library is a high-tech Python Package with an advanced set of tools for making 2D games with gripping graphics and sound. It is Object-oriented and is specially built for Python 3.6 and above versions. Arcade has two inbuilt functions for drawing arc: 1: arcade.draw_arc_outline ( ): This
2 min read
Draw a parabola using Arcade in Python3 Arcade is a Python library which is used for developing 2Dimensional Games. Arcade needs support for OpenGL 3.3+. In arcade, basic drawing does not require knowledge on how to define functions or classes or how to do loops, simply we have inbuilt functions for drawing primitives. Arcade inbuilt func
3 min read
Draw a circle using Arcade in Python3 The arcade library is a high-tech Python Package with advanced set of tools for making 2D games with gripping graphics and sound. It is Object-oriented and is especially built for Python 3.6 and above versions. Arcade inbuilt functions to draw circle :- 1. arcade.draw_circle_outline( ) : This functi
3 min read
Arcade Library in Python For many years, Python game programmers were limited to the Pygame Module. But, now we have other choices as well i.e Arcade Python Library. The Arcade library is a modern Python Module used widely for developing 2D video games with compelling graphics and sound. Arcade is an object-oriented library
4 min read
Draw Ellipse Using Turtle in Python Prerequisite: Turtle Programming Basics Turtle is an inbuilt module in Python. It provides drawing using a screen (cardboard) and turtle (pen). To draw something on the screen, we need to move the turtle (pen). To move turtle, there are some functions i.e forward(), backward(), etc. Approach: The fo
2 min read
Draw a triangle using Arcade in Python Arcade is a Python library that is used for developing 2Dimensional Games. Arcade needs support for OpenGL 3.3+. In the arcade, basic drawing does not require knowledge on how to define functions or classes or how to do loops, simply we have inbuilt functions for drawing primitives. Arcade inbuilt f
2 min read
How to Draw a Circle Using Matplotlib in Python? A Circle is a mathematical figure formed by joining all points lying on the same plane and are at equal distance from a given point. We can plot a circle in python using Matplotlib. There are multiple ways to plot a Circle in python using Matplotlib. Method 1: Using matplotlib.patches.Circle() func
3 min read