Draw an Arc Using Arcade in Python

Python's Arcade library is a powerful 2D graphics framework for creating games and visual applications. In this article, we'll learn how to draw arcs using two different methods filled arcs and outlined arcs.

What is Arcade Library?

Arcade is a modern Python library built on top of Pyglet that provides simple tools for creating 2D games and graphics. It offers crossplatform compatibility and includes features like sprites, shapes, and animation support.

Installing Arcade

First, install the Arcade library using pip ?

pip install arcade

Method 1: Using draw_arc_filled()

This method creates a filled arc with solid color. The draw_arc_filled() function takes parameters for center coordinates, width, height, color, start angle, and end angle ?

import arcade

# Screen dimensions
SCREEN_WIDTH = 640
SCREEN_HEIGHT = 480

class ArcWindow(arcade.Window):
    def __init__(self):
        super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, "Filled Arc Example")
        arcade.set_background_color(arcade.color.WHITE)
    
    def on_draw(self):
        arcade.start_render()
        
        # Draw filled arc
        center_x = SCREEN_WIDTH // 2
        center_y = SCREEN_HEIGHT // 2
        width = 200
        height = 200
        start_angle = 45
        end_angle = 135
        
        arcade.draw_arc_filled(center_x, center_y, width, height, 
                              arcade.color.BLUE, start_angle, end_angle)

# Run the window
window = ArcWindow()
arcade.run()

Method 2: Using draw_arc_outline()

This method creates an outlined arc with customizable line width. The draw_arc_outline() function includes an additional parameter for line thickness ?

import arcade

# Screen dimensions
SCREEN_WIDTH = 640
SCREEN_HEIGHT = 480

class OutlineArcWindow(arcade.Window):
    def __init__(self):
        super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, "Outline Arc Example")
        arcade.set_background_color(arcade.color.WHITE)
    
    def on_draw(self):
        arcade.start_render()
        
        # Draw outlined arc
        center_x = SCREEN_WIDTH // 2
        center_y = SCREEN_HEIGHT // 2
        width = 200
        height = 200
        start_angle = 45
        end_angle = 135
        line_width = 5
        
        arcade.draw_arc_outline(center_x, center_y, width, height, 
                               arcade.color.RED, start_angle, end_angle, line_width)

# Run the window
window = OutlineArcWindow()
arcade.run()

Parameters Explained

Parameter Description Example
center_x, center_y Arc center coordinates 320, 240
width, height Arc dimensions 200, 200
color Arc color arcade.color.BLUE
start_angle Starting angle in degrees 45
end_angle Ending angle in degrees 135
line_width Outline thickness (outline only) 5

Multiple Arcs Example

You can draw multiple arcs with different properties ?

import arcade

SCREEN_WIDTH = 640
SCREEN_HEIGHT = 480

class MultipleArcsWindow(arcade.Window):
    def __init__(self):
        super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, "Multiple Arcs")
        arcade.set_background_color(arcade.color.WHITE)
    
    def on_draw(self):
        arcade.start_render()
        
        # Large filled arc
        arcade.draw_arc_filled(200, 300, 150, 150, arcade.color.BLUE, 0, 180)
        
        # Small outlined arc
        arcade.draw_arc_outline(440, 300, 100, 100, arcade.color.RED, 180, 360, 3)
        
        # Quarter arc
        arcade.draw_arc_filled(320, 150, 120, 120, arcade.color.GREEN, 270, 360)

window = MultipleArcsWindow()
arcade.run()

Common Tips

  • Angles are measured in degrees, starting from the positive xaxis

  • Use equal width and height for perfect circular arcs

  • Always call arcade.start_render() at the beginning of on_draw()

  • Experiment with different color combinations using arcade.color constants

Conclusion

Arcade provides two simple methods for drawing arcs: draw_arc_filled() for solid arcs and draw_arc_outline() for outlined arcs. Both methods offer precise control over positioning, size, angles, and appearance, making them perfect for creating visual elements in 2D games and applications.

Updated on: 2026-03-27T14:33:31+05:30

413 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements