#!/usr/bin/python3 # zeigt eine Textzeile mit Betriebssystem-Zeichensatz import pygame from pygame.locals import * # # Text definition list_of_lines = [ "Hallo Jena!", "Hallo Welt!", ] textcolor = pygame.Color("gold") # named color # https://www.pygame.org/docs/ref/color_list.html # # Text output function def text_output(): font = pygame.font.SysFont("notosansmono",25) x_pos = 80 ; y_pos = 80 # Anfangsposition for line in list_of_lines: bild=font.render(line, True, textcolor) # parameter True: use antialiasing (looks better) screen.blit(bild,(x_pos, y_pos)) y_pos = y_pos + 30 # # Inition of Pygame, text output and display pygame.init() pygame.mouse.set_visible(False) screen = pygame.display.set_mode() # without parameters: use current screen resolution backcolor = pygame.Color("darkgray") # named color screen.fill(backcolor) text_output() pygame.display.flip() # # Waiting for a key press waiting=True while waiting: for event in pygame.event.get(): if event.type == pygame.KEYDOWN: waiting=False # # End # print(pygame.font.get_fonts()) # available fonts print(pygame.display.set_mode()) pygame.quit()