From 5d921239e0577988e2b7814025149d9160ecbdda Mon Sep 17 00:00:00 2001 From: Viljami Ilola <+@hix.fi> Date: Fri, 15 Mar 2024 17:44:52 +0200 Subject: full screen, please --- .gitignore | 3 +++ src/sliceitoff/display/__init__.py | 1 + src/sliceitoff/display/display.py | 17 +++++++++++++++++ src/sliceitoff/main.py | 15 +++++++++++++++ 4 files changed, 36 insertions(+) create mode 100644 src/sliceitoff/display/__init__.py create mode 100644 src/sliceitoff/display/display.py create mode 100644 src/sliceitoff/main.py diff --git a/.gitignore b/.gitignore index 40e5945..9ad0382 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# Caches +__pycache__ + # Editor backups *~ diff --git a/src/sliceitoff/display/__init__.py b/src/sliceitoff/display/__init__.py new file mode 100644 index 0000000..6332319 --- /dev/null +++ b/src/sliceitoff/display/__init__.py @@ -0,0 +1 @@ +from .display import Display diff --git a/src/sliceitoff/display/display.py b/src/sliceitoff/display/display.py new file mode 100644 index 0000000..151bb11 --- /dev/null +++ b/src/sliceitoff/display/display.py @@ -0,0 +1,17 @@ +import pygame + +class Display(): + def __init__(self): + pygame.display.init() + mode_info = pygame.display.Info() + self.screen = pygame.display.set_mode( + (mode_info.current_w, mode_info.current_h), + pygame.FULLSCREEN ) + + def update(self, groups = None): + """ Updates the screen: clear, blit gropus and flip """ + self.screen.fill() + pygame.display.flip() + + def __del__(self): + pygame.display.quit() diff --git a/src/sliceitoff/main.py b/src/sliceitoff/main.py new file mode 100644 index 0000000..5f1f3ce --- /dev/null +++ b/src/sliceitoff/main.py @@ -0,0 +1,15 @@ +from pygame import ( + init as pg_init, + quit as pg_quit) + +from time import sleep + +from display import Display + +def main(): + pg_init() + d = Display() + sleep(4) + pg_quit() + +main() \ No newline at end of file -- cgit v1.2.3