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.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 :: python better while loop that count up 
Python :: fstring number format python 
Python :: prime number program in python print 1 to 100 
Python :: python split list of tuples in two lists 
Python :: python reduce function to sum array 
Python :: matplotlib create histogram edge color 
Python :: show aruco marker axis opencv python 
Python :: floyd triangle python 
Python :: rename files in a folder python 
Python :: matplotlib boxplot remove outliers 
Python :: rangoli in python 
Python :: python subtract one list from another 
Python :: read text from a pdffile python 
Python :: python loop certain number of times 
Python :: get index pandas condition 
Python :: can you print to multiple output files python 
Python :: check if user has manage messages discord.py 
Python :: python negation of an statement 
Python :: install python setuptools ubuntu 
Python :: sqlalchemy if a value in list of values 
Python :: from PyQt5 import Qsci 
Python :: playsound moudle python 
Python :: plot horizontal line in python 
Python :: gspread send dataframe to sheet 
Python :: get current directory python 
Python :: make pandas df from np array 
Python :: how to get location of word in list in python 
Python :: play wav files python 
Python :: label encode one column pandas 
Python :: read text file in python 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =