Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pygame.Rect

pygame.Rect(top, left, width, height) # all values are integers in pixels
Comment

pygame.draw.rect()

gameDisplay = pygame.display.set_mode((width,height))
bright_blue =(0,255,255)

# draw rectangle 
pygame.draw.rect(gameDisplay, bright_blue ,(611,473,100,50))
Comment

pygame rect

pygame.draw.rect(surface, colour, Rect)
#Rect would be a .Rect() variable. 
Comment

pygame get rect

# get_rect() method is applied to Surfaces creating a rectangle of its shape.
import pygame as pg
surf_img = pg.image.load("some_image.png")
surf_img_rect = surf_image.get_rect(topleft=(x_coordinate,y_coordinate))

##  in which topleft sets the position where the rect is placed.
##  you can also use the following parameters as position arguments: 
##	bottomleft = (x,y)
##  center = (x,y) 	
##  topleft = (x,y)
Comment

PREVIOUS NEXT
Code Example
Python :: python set cwd to script directory 
Python :: slicing string in python 
Python :: python file count 
Python :: how to make getter in python 
Python :: python iterate through files in directory 
Python :: pandas dataframe read string as date 
Python :: create a dictionary in python 
Python :: keras example 
Python :: remove a column from dataframe 
Python :: python convert string to float array 
Python :: pandas distinct 
Python :: seaborn bar plot 
Python :: Python Requests Library Put Method 
Python :: list of numbers 
Python :: setting p a virtual envioronment 
Python :: how to append a number to a list in python 
Python :: python checking if something is equal to NaN 
Python :: python slice string 
Python :: how to make a program that identifies positives and negatives in python 
Python :: how to sort a dictionary py 
Python :: check object type python 
Python :: get tail of dataframe pandas 
Python :: How to scale a pandas dataframe 
Python :: delete one pymongo 
Python :: python convert to percentage 
Python :: day name in python 
Python :: how to clear ipython console 
Python :: pandas max columns 
Python :: batchnormalization keras 
Python :: sum of 2 numbers in python 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =