Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pygame draw rect syntax

pygame.draw.rect(SURFACE, RGB_COLOR, (X, Y, WIDTH, HEIGHT))
Comment

how to draw a rectangle in pygame

# Importing the library
import pygame
  
# Initializing Pygame
pygame.init()
  
# Initializing surface
surface = pygame.display.set_mode((400,300))
  
# Initialing Color
color = (255,0,0)
  
# Drawing Rectangle
pygame.draw.rect(surface, color, pygame.Rect(30, 30, 60, 60))
pygame.display.flip()
Comment

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 draw rect

pygame.draw.rect(window, color, (x, y, width, height))
Comment

pygame draw rect

rectangle = pygame.Rect(x, y, width, height)
pygame.draw.rect(window, color, rectangle)
Comment

PREVIOUS NEXT
Code Example
Python :: get dictionary value python 
Python :: dataframe string find count 
Python :: push element to list python 
Python :: how to set variable to null in python 
Python :: telethon send image 
Python :: redirect parameters flask 
Python :: django collectstatic 
Python :: python partial 
Python :: check type of django messages 
Python :: python re compile 
Python :: run python.py file 
Python :: pandas dataframe column based on another column 
Python :: how to append items to a list in python 
Python :: breadth first search python 
Python :: how to find highest number in list without using max function python 
Python :: isdigit python 
Python :: how to change index date format pandas 
Python :: how to check if item is in the variable python 
Python :: get multiple inputs in python 
Python :: cheat sheet python 
Python :: if name 
Python :: raspberry pi keyboard python input 
Python :: vscode set python identation to four 
Python :: how do i get parent directory python 
Python :: python selenium click element 
Python :: matplotlib subplots 
Python :: python while false loop 
Python :: shift list python 
Python :: unique list values python ordered 
Python :: feature to determine image too dark opencv 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =