Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Draw a sun using arcade library Python

  • Difficulty Level : Expert
  • Last Updated : 11 Oct, 2020

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 library. It can be installed like any other Python Package.


To install this module, just simply run the following command on your command prompt:

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course

pip install arcade


The following steps illustrate how to create a basic drawing using arcade module:

  • Import module.
  • Specify the parameters for your output screen like width, height, etc.
  • Open the window using the inbuilt open_window() in arcade. This command opens a window with a given size i.e width and height along with screen title.
  • Set a background color (optional). It can be done using set_background_color() method built into arcade
  • Tell your module to start drawing using start_render() command which is again built into arcade.
  • Start designing, you can use functions already available with arcade to do so.
  • Tell arcade module that you have completed the drawing using finish_render().
  • Run your code using run().


# import module
import arcade
# set parameters 
Width= 700
# open window
arcade.open_window(Width, Height, Title)
# Set the background color
# Get ready to draw
# Draw a sun
arcade.draw_circle_filled(500, 550, 40, arcade.color.YELLOW)
# Rays to the left, right, up, and down
arcade.draw_line(500, 550, 400, 550, arcade.color.YELLOW, 3)
arcade.draw_line(500, 550, 600, 550, arcade.color.YELLOW, 3)
arcade.draw_line(500, 550, 500, 450, arcade.color.YELLOW, 3)
arcade.draw_line(500, 550, 500, 650, arcade.color.YELLOW, 3)
# Diagonal ray
arcade.draw_line(500, 550, 550, 600, arcade.color.YELLOW, 3)
arcade.draw_line(500, 550, 550, 500, arcade.color.YELLOW, 3)
arcade.draw_line(500, 550, 450, 600, arcade.color.YELLOW, 3)
arcade.draw_line(500, 550, 450, 500, arcade.color.YELLOW, 3)
# Finish drawing
# Keep the window up until someone closes it.


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!