0

Hey I am new to python and pygame. I started to program simple things in python and wanted to try coding a game now. Why is my only output a blank window?

import pygame
pygame.init()

window = pygame.display.set_mode((800, 600))
pygame.display.set_caption("Dungeon")

class Living:
  def __init__(self, x, y, height, width, health):
    self.x = x
    self.y = y
    self.height = height
    self.width = width
    self.health = health

run = True
while run:
  pygame.time.delay(100)

  for event in pygame.event.get():
    if event.type == pygame.QUIT:
      run = False

  hero = Living(50, 50, 30, 20, 100)
  pygame.draw.rect(window, (255, 0, 0), (hero.x, hero.y, hero.height, hero.width))
  pygame.display.update()

pygame.quit()
Rabbid76
  • 202,892
  • 27
  • 131
  • 174
ZoKi Mo
  • 51
  • 1
  • 5
  • 1
    Sorry, but the issue is not reproducible. What is you OS? What is python and pygame version? – Rabbid76 May 14 '20 at 20:48
  • @Rabbid76 i am using python 3.7, pygame 1.9.6 on a MacBook Pro 2017 with macOS Catalina Version 10.15.4. I get no errors, just a blank window in the size I want with our rectangle – ZoKi Mo May 15 '20 at 06:23
  • Try `python3 -m pip install pygame==2.0.0.dev6` – Rabbid76 May 15 '20 at 06:28
  • @Rabbid76 now I get an error "import pygame ModuleNotFoundError: No module named 'pygame' " – ZoKi Mo May 15 '20 at 06:37

0 Answers0