Question: python hello world shapes import pygame import sys from pygame.locals import * # Set up pygame. pygame.init ( ) # Set up the window. windowSurface
python hello world shapes
import pygame
import sys
from pygame.locals import
# Set up pygame.
pygame.init
# Set up the window.
windowSurface pygame.display.setmode
pygame.display.setcaptionHello world!
# Set up the colors.
BLACK
WHITE
RED
GREEN
BLUE
# Set up the fonts.
basicFont pygame.font.SysFontNone
# Set up the text.
text basicFont.renderHello world! True, WHITE, BLUE
textRect text.getrect
textRect.centerx windowSurface.getrectcenterx
textRect.centery windowSurface.getrectcentery
# Draw the white background onto the surface.
windowSurface.fillBLUE
# Draw a green polygon onto the surface.
pygame.draw.trianglewindowSurface BLUE,
# Draw some blue lines onto the surface.
pygame.draw.linewindowSurface RED,
pygame.draw.linewindowSurface GREEN,
pygame.draw.linewindowSurface BLACK,
# Draw a blue circle onto the surface.
pygame.draw.circlewindowSurface GREEN,
# Draw a red ellipse onto the surface.
pygame.draw.ellipsewindowSurface BLACK,
# Draw the text's background rectangle onto the surface.
pygame.draw.rectwindowSurface GREEN, textRectleft
textRect.top textRect.width textRect.height
# Get a pixel array of the surface.
pixArray pygame.PixelArraywindowSurface
pixArray BLUE
del pixArray
# Draw the text onto the surface.
windowSurface.blittext textRect
# Draw the window onto the screen.
pygame.display.update
# Run the game loop.
while True:
for event in pygame.event.get:
if event.type QUIT:
pygame.quit
sysexit
change so that line is polygon attribute
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
