'OOP using pygame.display inheritance error
import pygame.display.Display as display
class MainDisplay(display):
def __init__(self):
super.__init__()
# creating display
X = 500
Y = 1000
display = self.set_mode((X, Y))
The following code is giving this type error:
module() takes at most 2 arguments (3 given)
Is this because pygame.display is a module not a class? How could I fix this error?
edit: this is the full traceback
Traceback (most recent call last):
File "/Users/siyunlee/Desktop/coding/personal/games/dino game/main.py", line 4, in <module>
class MainDisplay(display):
TypeError: module() takes at most 2 arguments (3 given)
Solution 1:[1]
This is a simple example of how to make a window I recommend using this:
import pygame
class MainDisplay():
def __init__(self):
pygame.display.init()
self.screen = pygame.display.set_mode((800, 600))
MainDisplay()
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
quit()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |