[Chennaipy] Chennaipy - Monday Module - 12 Dec 2022

selvi dct selvi.dct at gmail.com
Mon Dec 12 12:48:40 EST 2022


Date: 12 Dec 2022


Module: pygame


Installation: pip install pygame


About:

pygame is a free and open-source cross-platform library for the development
of multimedia applications like video games using Python.


SourceCode:

# Simple pygame program


# Import and initialize the pygame library

import pygame

pygame.init()


# Set up the drawing window

screen = pygame.display.set_mode([500, 500])


# Run until the user asks to quit

running = True

while running:


    # Did the user click the window close button?

    for event in pygame.event.get():

if event.type == pygame.QUIT:

    running = False


    # Fill the background with white

    screen.fill((255, 255, 255))


    # Draw a solid blue circle in the center

    pygame.draw.circle(screen, (0, 0, 255), (250, 250), 75)


    # Flip the display

    pygame.display.flip()


# Done! Time to quit.

pygame.quit()


Reference:

https://pypi.org/project/pygame/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/chennaipy/attachments/20221212/f92ca7b5/attachment.html>


More information about the Chennaipy mailing list