31 lines
846 B
Python
31 lines
846 B
Python
![]() |
import pygame
|
||
|
|
||
|
class Window:
|
||
|
window:None
|
||
|
width:int
|
||
|
height:int
|
||
|
title:str
|
||
|
icon_path:str
|
||
|
|
||
|
def __init__(self, width:int=640, height:int=480, title="", icon_path=""):
|
||
|
self.set_resolution(width,height)
|
||
|
self.set_title(title)
|
||
|
self.set_icon(icon_path)
|
||
|
self.mount()
|
||
|
|
||
|
def set_resolution(self, width:int, height:int):
|
||
|
self.width = width
|
||
|
self.height = height
|
||
|
|
||
|
def set_title(self, title:str):
|
||
|
self.title=title
|
||
|
|
||
|
def set_icon(self, icon_path:str):
|
||
|
self.icon_path= icon_path
|
||
|
|
||
|
def mount(self):
|
||
|
self.window = pygame.display.set_mode((self.width,self.height))
|
||
|
pygame.display.set_caption(self.title)
|
||
|
if self.icon_path != "":
|
||
|
icon = pygame.image.load(self.icon_path)
|
||
|
pygame.display.set_icon(icon)
|