how to make a rectangle in pygame

Solutions on MaxInterview for how to make a rectangle in pygame by the best coders in the world

showing results for - "how to make a rectangle in pygame"
Samuel
15 May 2018
1# make the x position, y position, width and the height of the rectangle
2x_pos = 20
3y_pos = 20
4width = 50
5height = 50
6
7# make the rectangle variable
8rectangle = pygame.Rect(x_pos, y_pos, width, height)
9
10# now add this to a surface, add a colour and the rectangle and make it a function
11def make_rect():
12	pygame.draw.rect(surface, (RGB colour in this tuple), rectangle)
13
14
15# after this add it to your infinite loop
16run = True
17while run:
18    for event in pygame.event.get():
19        if event.type == pygame.QUIT:
20            run = False
21            
22	make_rect()
23    pygame.display.update()
Dolores
11 Feb 2018
1pygame.draw.rect(SURFACE, RGB_COLOR, (X, Y, WIDTH, HEIGHT))
Javier
18 Jul 2020
1# rectangle colour
2rect_colour = (RGB VALUE)
3
4# define the x, y, width & height for the rectangle
5x_position = 30
6y_position = 30
7rect_width = 60
8rect_height = 60
9
10# draw the rectangle
11pygame.draw.rect(screen, rect_colour, pygame.Rect(rect_width, rect_height))
Daire
30 Mar 2018
1 pygame.draw.rect(DISPLAY,BLUE,(200,150,100,50))
queries leading to this page
draw a how rect pygamepygame linesdraw square pygamecant draw rectangle pygamedraw line in pygamepygame how to draw a pointwhat is rect in pygamepygame fill rectpygame ringpygame draw rectangle outlinecolor fase pygame linehow to fill a rectangle in pygamedraw a line in pygamerectange pygamepygame render polygonpygame draw rectangle with borderhow to pygame draw a rectangledraw rectangels in pygamepygame create squarepygame draw circle functionpygame draw rect pythonpygame draw rect examplepygame draw circle ahow to make squiggles in pygamedraw rect pygame exemplesdraw a circle pygamemake rectangle in pygamepygame rect and pygame rectdraw rect in pygamerecy stroke in pygamesdraw oval pygamerectangle from image pygamepygame drawing rectdraw line with pygamepygame rect objecthow to insert a rectangle in pygamedrawing a rectanlge pygamepygame draw rect syntaxusing draw rectpygame draw rect documentationhow to make a black outline around white circle pyga 2cepygame draw rect outlinespygame fill a rectanglehow to create a rectangle in pygame with a tuple pygame shapesbasic triangle in pygameadding rectangles to pygamepygame draw rectangle examplerectangle pygamepygame rectanglepygame ellipsehow can we make a rectangle through pygame rectdisplay drawrect pygamerectangle pygame drawhow to create a rectangle button in pygamepython rect filldrawing rect in pygame 27drawing with pygamepygame add rectmake a rect pygamepygame drawrectangles pygamedeclare rectangle pygamedraw a rectagle in pygamepygame draw xhow to draw a square in python in pygamemaking a rectangle in pygamepygame create rectdraw gree square pygamwhat is rect pygamepygame curved linesrectangle python pygamehow to move a rect in pygamehow to user pygame draw rectdrawing a rectangle in pygamerect tutorial in pygamecreate a rectangle in pygamehow to draw an arc in pygamecreate rectangle in pygamedraw line from coordinates pygamepygame docs recthow to update rectangle pygamedraw rect pygamedraw a rect in pygamedraw circle pygamepygame how to draw reddraw rect in pygamepygame rect colorhow to draw rectangle in pygamepygame draw circle examplepygame retangle in pythonpygame filled rectanglepygame draw polygondraw rectangle in pygamepygame drawhow to draw a rectangle in python pygamedraw rect function pygamepygame draw eclipsehow to draw a rectangle on a window in pygamepygame draw a rectangle from pointspygame draw rect rectangle tutorialpygame draw rectdraw rectangle python pygamehow to draw a line in pygeme without pointy thingpygame get rect tutorialpygame rect 2b recthow to draw pygame rectpygame draw rect classdraw rect parameterspygame rotate a rectangledraw a box pygamepygame draw rectstraight line pygameblit a square in pygamehow to make rectangle in pygamepygame draw circle documentationpygame draw pylygonpygame draw squarehow to create rectangle in pygamedraw rects pygamepygame solid rectanglehow to draw an image into a rectangle in pygamepygame make rectanglediameter of pygame draw circle 28window 2c 280 2c 0 2c 50 29 2c 2850 2c 100 29 2c 100 29instructivos draw rect pythonpygame draw on surfacepygame draw rectpygame shapepygame draw linesdraw stuff with pygamepygame python 3 draw rectanglepygame fill in a circlepygame make rectangle smallerhwo to draw a rectangle in pygamepython pygame draw rectallpygame possible shapeshow to make a rect pygamepygame display rectanglehow to draw an object in pygamepygame rectangglepython pygame draw circlelines pygamehow to draw a rect in pygamerectangle in pygamepygame how to create a rectangle with a clickhow to draw a rectangle in pygame rect pygamehow to create a triangle in pygamehow to draw rect in pygamepyga 2ce draw rectdraw rectange in pygamedraw rectangle pygamepygame draw rect a variablepygame rectanglgepygame rect drawpygame rectangkepygame draw recpygame draw rect pygamewhich direction does pygame draw rectanglesdef draw select box 28x 2c y 29 3a px 2c py 3d getcoord 28x 2c y 29 pg draw rect 28screen 2c color 28 27red 27 29 2c 28px 5 2c py 5 2c squaresize 2b 10 2c squaresize 2b 10 29 2c 5 29pygame draw rec 28 29 give strokedraw circle pygamepygame drwa linepygame drawing shapeshow to draw a rectoangle with pygamehow to make a rectangle move in python pygamehow to draw a rectangle 2fplayer on surface in python pygamepygame draw linepygame draw a rectangle that not arasepygame empty squarehow to make a circle in pygamedraw a rectangle in pygamedraw circle in pygamepygame line argspygame polygon to surfacepygame how to draw rectdraw rect 28 29how to make a rectange pygamepygame draw recthow do i drwa a line in pygamehow to draw a rectangle outline in pygamehow to draw rectangle pygamedrawing a circle pygmaehow to add rectangle pygamedrawing rectangle in pygamedraw with rectangle pygamemake a black rectangle in pygamepygame rect draw rectangle when clicked pygamecreate rectangle pygamedraw square pythongamerect pygamedrawing rectangle pygamepygame draw circlpython pygame draw rectanglehow to get a rectangle in pygamepygame draw rect 28self game screenhow to turn a polygon into a rect in pygamepygame draw rectanglehow to link rectangles in pygamehow to draw out a rect ion pygamepygame draw image on rectanglepygame circle rectdeclare rectangle pygame pythonpygame recdraw small outline circle pygamepygame create rectangle objectdraw pygame rectpygame draw filled rectangledraw a rect pygameadd data to a rectangle pygamepygame rect explainedhow to make rect pygamepygame create recpygame how to draw a recthow to make a pygame squarepoints in pygamepygame how to draw a rectangle without a middlehow to move rectangles in pygamecreating a rectangle in pygamepygame draw eclipsepygame displaying a rectanglepygame how to draw a rectangle at a positionhow to add a rectangle in pygamehow to make a rectangle fall in pygamepygame draw parallelogrampygame cirlcepygame rectangle colormake rectangle pygamepygame rectangle fillpygame recthow to make a rectangle in python pygamepygame how to draw already made rectangleadding rect pygamepygame rect draw examplehow to turn a drawing into a rect in pygamehow to draw a line pygamedraw line pygamehow to draw rectangle around a image in pygamehow to make a rect python pygamerectangels in pygamehow to render a rectangle in python pygamedraw line pygamepygame example draw a rectanglehow to make new rectangle pygamehow to print rectangle in python using pygamepygame 1 9 6 draw rectanglehousehow to move a rectangle in pygame codedraw a rectangle pygamepygame draw rectangle on surfacepygame draw line examplepygame draw rect in pythonpygame relocate rectanglehow to draw patterns on your pygame windowpygame polygonpygame how to draw cthow to make rectangle see through in pygamepygame how to draw a circlehow to rect for a circle in pygamehow to make rect in pygamesquare pygamehow to draw a rectangle in pygame nerd paradisedrawing a square in pygamepygame rectangle drawpygame draw rect parametershow to create a rectangle in pygamedraw rectangle on screen pygamemaking non rectangles in pygamehow to draw rectangel pygamehow to move a rectangle in pygamepygame linepygame draw rhombushow to draw lines with pygamehow to a boarder box for circle pygamehow to draw a rectangle in pygamelines in pygameshow to draw a rec on pygamehow to mave a rectangle in pygamepygame rectspygame recthow do i draw a rectangle in pygamepygame draw a rectanglepygame draw lindraw rectange pygamepygame draw trianglehow to code a rectangle in pygamepygame rect syntaxhow to draw a rectangle on an image in pygamecoordinates pygame draw rectpygame rectangle pointshow to convert a rectangle into a pygamecreate rect pygamepygame drawinghow tdo you draw a dot so far from a point at an ange in pygamepolygon pygamedraw a rectange pygamefill rectangle in pygamemake a rectangle pygamepygame draw rectangle with 4 pointspygame draw dotpygame how to make a rectanglemake a good rectangle in pygamedraw rect pygamedraw rectangle at an angle pygamepygame draw rectzpygame draw rect 28win 2c 28255 2c 0 2c 0 29 2c 28x 2c y 2c gubbe width 2c gubbe height 29 29 nameerror 3a name 27win 27 is not definedpygame draw lines examplepygame make rectdraw retnagle in pygamepygame polygonspygame draw tutorialmake rectangle pygame pythonhow to draw a rect pygamepygame draw rect 5cpygame example rectanglepygame fill shapehow to darw a rect in pygamehow to make a rectangle in pygamepygamedraw linecreating rectangle in pygamedrawing lines in pygamepygame how to draw a rectanglepygame draw ellipsedraw recthow to draw a pygame rectpygame draw rectangle behindrect draw pygamehow to draw rect pygamepython pygame draw circle 28 29can you put objects in rectangles pygamepygame create rectanglehow to make a rectanlge pygamehow to destroy rectangle in python pygamepygame ellipsepygame deelte rectanglepygame draw a rectangle from 4 xy pointshow to draw a line in pygame from user inputrect in pygamepygame how to make a circledraw triangle in pygamepygame draw rect circlepython pygame pygame draw rect 28 29pygame blit rectanglepygame not drawing rectanglehow to draw a rect at a position pygamepygame drae lineshow to display a rectangle in pygamedraw a square into a rect pygamehow to max a bbox for circle pygamepygame rectangelslines in pygmaegame draw rect syntaxpygame draw rect exampledraw rectangle on pygame windowpygame drawing lineshow to make a square in pygamepy game draw colored rectanglepygame add rectangledrawing multiple shapes in pygamedrawing rectangles in pygamehow to define rect in pygamewhat parameters go in pygame draw rectpygame draw rect colourpygame draw rectangle tutorialpygame trianglerectangle draw pygamehow to draw a square in pygamepygame draw alpha libraryhow to fill pygame draw rectpython pygame drawingcircle pygamedraw pygamepygame draw rect and fillpygae pygame draw rectpygame srceen drawstroke in pygamespython pygame draw arcpygame draw rect attributeshow do you draw a rectangle in pygamepygame draw lienhow to draw in pygamepygame code to make rectangledrawing in pygameshow to make a rect in pygamehow to create a rect in pygamepygame example drawing a rectanglepygame rect syntaxpygame draw linedraw rectangles pygamepygame drawing rectanglesdraw rectangle from two points pygamepygame draw rect 28 29puygame draw recthow to move rectangle in pygamepygame draw polygon function if clickedpygame draw rect rectangle examplepygame draw objectpygame draw a rectdraw a rect on a window pyagemhow to draw a rectangle pygamehow to make a rectangle in pygame