Advertisement
rric

Coole_Farb_Texte

Oct 10th, 2023 (edited)
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.52 KB | None | 0 0
  1. # Erweitertes "Hallo Welt" mit Text und Farben [Mu: Pygame Zero]
  2. # Copyright 2022, 2023 Roland Richter
  3.  
  4. # Erzeuge ein rechteckiges 800×500 Fenster
  5. WIDTH = 800
  6. HEIGHT = 500
  7.  
  8. def draw():
  9.     # Setze den Hintergrund auf "Pansy purple"
  10.     # TIPP Farbnamen gibt's auf http://latexcolor.com/
  11.     #      oder https://www.w3schools.com/colors/colors_names.asp
  12.     screen.fill("#78184A")
  13.  
  14.     # Begrüße alle in der Mitte der Leinwand
  15.     screen.draw.text("Hallo Welt!", (300, 300))
  16.  
  17.     screen.draw.filled_rect(Rect((100, 200), (150, 40)), "blue")
  18.  
  19.     # PROBIERE den Text besser lesbar zu machen
  20.     screen.draw.text("Es ist spannend,", (280, 340))
  21.     screen.draw.text("Python zu lernen", (320, 380))
  22.  
  23.     # QUIZ Wo siehst du die Ausgabe des print(...)-Befehls?
  24.     print("Hallo Konsole!")
  25.  
  26. def update():
  27.     pass
  28.  
  29. # ----------------------------------------------------------------------
  30. # This program is free software: you can redistribute it and/or modify
  31. # it under the terms of the GNU General Public License as published by
  32. # the Free Software Foundation, either version 3 of the License, or
  33. # (at your option) any later version.
  34. #
  35. # This program is distributed in the hope that it will be useful,
  36. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  37. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  38. # GNU General Public License for more details.
  39. #
  40. # You should have received a copy of the GNU General Public License
  41. # along with this program.  If not, see <https://www.gnu.org/licenses/>.
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement