Skip to content

Hello World! #8

Description

@seblin

Habe hier mal ein billiges erstes Beispiel für die Verwendung von PyGame gebastelt:

#!/usr/bin/env python3
import pygame

BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)

def init_window(title, width=640, height=480, background=None):
    pygame.init()
    pygame.display.set_caption(title)
    screen = pygame.display.set_mode((width, height))
    if background:
        screen.fill(background)
    pygame.display.update()
    return screen

def run_game():
    while True:
        event = pygame.event.wait()
        if event.type == pygame.QUIT:
            break

def main():
    init_window('Hello World', background=BLUE)
    run_game()

if __name__ == '__main__':
    main()

Vielleicht hat ja jemand Lust, ein bißchen damit rumzuspielen...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions