Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pygame Drawing a Rectangle

Tags:

People also ask

How do you draw a rectangle in Pygame?

The most basic way to create a Rect object in Pygame is to simply pass two tuples into the Pygame. Rect() Class. The first tuple (left, top) represents the position of the rect on the window, whereas the second tuple (width, height) represents the dimensions of the Rect.

How do you make a rectangle in python?

We can create a simple rectangle by defining a function that takes in two integers representing side length and side height. Then we can loop four times, using the forward() function to create a side representing either the length or height, then rotating the cursor 90 degrees with the right() function.

What is a rectangle in Pygame?

The rectangle is a very useful object in graphics programming. It has its own Rect class in Pygame and is used to store and manipulate a rectangular area. A Rect object can be created by giving: the 4 parameters left, top, width and height. the position and size.


Im making a game that requires knowing how to draw a rectangle in python 3.2.

I have checked lot of sources but none show exactly how to do it.

Thanks!