Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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 how to draw a rectangle

 pygame.draw.rect(DISPLAY,BLUE,(200,150,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 :: print map object python 
Python :: pip install for python 2 and python3 
Python :: circumference of circle 
Python :: django get group users 
Python :: exec: "python": executable file not found in $PATH Error compiling for board ESP32 Dev Module. 
Python :: how to make a countdown in pygame 
Python :: python set cwd to script directory 
Python :: endswith python 
Python :: python get stock prices 
Python :: is number python 
Python :: how to resize tkinter window 
Python :: find index of maximum value in list python 
Python :: np argmin top n 
Python :: python swap two values in list 
Python :: Python Requests Library Put Method 
Python :: timestamp to date time till milliseconds python 
Python :: how to make django model field case insensitive 
Python :: python string to int 
Python :: python raw string 
Python :: pandas strip whitespace 
Python :: object to int and float conversion pandas 
Python :: Clear All the Chat in Discord Channel With Bot Python COde 
Python :: drop all characters after a character in python 
Python :: reading json file in python 
Python :: python open file from explorer 
Python :: python write binary 
Python :: repeat array along new axis 
Python :: fstring 
Python :: check pyenv version windows 
Python :: python kill all threads 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =