Open In App

Arcade inbuilt functions to draw polygon in Python3

Last Updated : 11 Oct, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

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 has two inbuilt functions for drawing a polygon:

1. arcade.draw_polygon_outline( ) : This function is used to draw the outline of the polygon. 

Syntax: arcade.draw_polygon_outline (point_list,  color,  line_width )

Parameters:

  • point_list: List of points making up the lines. Each point is in a list. So it is a list of lists.
  • color (Color): specify color using arcade.color.COLOR NAME. (Note that color name should in Capital letters.)
  • line_width:- Width of the line in pixels.

Example:

Python3




import arcade
  
# Open the window. Set the window title and dimensions (width and height)
arcade.open_window(600, 600, "Draw  a polygon for GfG ")
  
arcade.set_background_color(arcade.color.ORANGE)
  
# Start the render process.
arcade.start_render()
  
point_list = ((30, 240),
              (45, 240),
              (60, 255),
              (60, 285),
              (45, 300),
              (30, 300))
arcade.draw_polygon_outline(point_list, arcade.color.SPANISH_VIOLET, 3)
  
arcade.finish_render()
  
arcade.run()


Output:

2. arcade.draw_polygon_filled( ): This inbuilt function of arcade is used to draw polygon filled with color. 

Syntax: arcade.draw_polygon_filled (point_list, color )

Parameters:

  • point_list- It is basically List of points where each point is in a list. So it is a list of lists.
  • Color – specify color using arcade.color.COLOR NAME. (Note that color name should in Capital letters. )

Example:

Python3




import arcade
  
# Open the window. Set the window title and dimensions (width and height)
arcade.open_window(600, 600, "Draw  a polygon for GfG ")
  
arcade.set_background_color(arcade.color.ORANGE)
  
# Start the render process.
arcade.start_render()
  
point_list = ((150, 240),
              (165, 240),
              (180, 255),
              (180, 285),
              (165, 300),
              (150, 300))
arcade.draw_polygon_filled(point_list, arcade.color.SPANISH_VIOLET)
  
arcade.finish_render()
  
arcade.run()


Output:



Similar Reads

Arcade inbuilt functions to draw point(s) in Python3
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. In this article, we will learn what are the arcade inbuilt functions to draw point. Arcade library is a modern framework, which makes draw
3 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 function for drawing parabola:- 1. arcade.draw_parabol
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 function is used to draw the outline of a circle. Syntax
3 min read
How to show a timer on screen using arcade in Python3?
Prerequisite: Arcade library Arcade is a modern framework, which is used to make 2D video games. In this, article, you will learn how to show an on-screen timer using the arcade module of Python. Displaying a timer on screen is not tough job, just follow the below steps:- Step 1: First of all import the arcade module of Python C/C++ Code Step 2: De
2 min read
Making an object jump with gravity using arcade module in Python3
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. Now, it’s up to the necessity of the developer, what type of game, graphics, and sound he/she wants to use using this toolkit. So, in this
4 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, we are drawing a pine tree made up of a rectangl
3 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 function is used to draw an arc which is useful fo
2 min read
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 given size i.e width and height along with screen t
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 library. It can be installed like any other Python Pack
2 min read
Draw an ellipse using Arcade library in Python
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
3 min read
Article Tags :
Practice Tags :
three90RightbarBannerImg