Answers for "draw squares pygame"

1

pygame how to draw square

#Importing the library
import pygame
  
# Initializing Pygame
pygame.init()
  
# Initializing screen
screen = pygame.display.set_mode((400,300))
  
# Initialing Color
color = (255,0,0)
  
# Drawing Rectangle
pygame.draw.rect(screen, color, pygame.Rect(30, 30, 60, 60))
pygame.display.flip()
Posted by: Guest on April-18-2021
6

draw a line pygame

pygame.draw.line(surface, color, start_pos, end_pos, width)
Posted by: Guest on June-16-2020
7

pygame circle

circle(surface, color, center, radius)
Posted by: Guest on June-18-2020

Python Answers by Framework

Browse Popular Code Answers by Language