Active6 months ago
- Pygame Draw Rect Example For Kids
- Pygame Draw Rect Example 2
- Pygame Draw Rect Example Online
- Pygame Circle Object
Im making a game that requires knowing how to draw a rectangle in python 3.2.
PyGame Tutorial: Geometric Drawing. Therefore instead of re-iterating the documentation as part of this tutorial, I'll instead show you a few simple (and not-so-simple) examples of what can be doing with the draw module in PyGame and a few pitfalls to be aware of. At the end of this tutorial/demo you'll see a massive code dump. The first argument is the surface instance to draw the rectangle to. The second argument is the (red, green, blue) tuple that represents the color to draw with. The third argument is a pygame.Rect instance. The arguments for this constructor are the x and y coordintaes of the top. May 21, 2014 VIDEO SHOWING YOU HOW TO DRAW BASIC SHAPES IN PYGAME -CODE BELOW- import pygame from pygame.locals import. pygame.init window = pygame.display.setmode(.
I have checked lot of sources but none show exactly how to do it.
Pygame module for drawing shapes pygame.draw.rect — draw a rectangle shape pygame.draw.polygon — draw a shape with any number of sides pygame.draw.circle — draw a circle around a point pygame.draw.ellipse — draw a round shape inside a rectangle pygame.draw.arc — draw a partial section of an ellipse pygame.draw.line — draw a straight line. Pygame (Python Game Development) Tutorial - 10 - More User Control - Duration: 5:26. Thenewboston 49,886 views.
Thanks!
Pygame Draw Rect Example For Kids
JaredJared
3 Answers
If you'd thoroughly checked the sources you purported to have checked, then you would've found how to draw a rectangle- the simplest of tasks in pygame. But since you asked, here's how:
This creates a simple window 500 pixels by 400 pixels that is white. Within the window will be a blue rectangle. You need to use the
pygame.draw.rect
to go about this, and you add the DISPLAY
constant to add it to the screen, the variable blue to make it blue (blue is a tuple that values which equate to blue in the RGB values and it's coordinates.Look up pygame.org for more info
Mateusz Konieczny86511 gold badge1515 silver badges3737 bronze badges
user1800989
Have you tried this:
Taken from the site:
pygame.draw.rect(screen, color, (x,y,width,height), thickness) draws a rectangle (x,y,width,height) is a Python tuple x,y are the coordinates of the upper left hand corner width, height are the width and height of the rectangle thickness is the thickness of the line. If it is zero, the rectangle is filled
![Online Online](/uploads/1/2/4/8/124894237/283910690.jpg)
Pygame Draw Rect Example 2
PhorcePygame Draw Rect Example Online
Phorce1,92766 gold badges3838 silver badges7575 bronze badges
l. zhangl. zhang