Pygame: No feedback

Viewed 10

I create a progam in pygame and on cv2, and when I run, nothing happens, nothing opens up just to be spelled in the console: pygame 2.1.2 (SDL 2.0.18, Python 3.10.7) Hello from the pygame community. https://www.pygame.org/contribute.html

from os import environ
environ['PYGAME_HIDE_SUPPORT_PROMPT'] = '1'

import pygame as pg
import cv2


class ArtConverter:
    def __init__(self, path='imgfromASCII.jpg'):
        pg.init()
        self.path = path
        self.image = cv2.imread(self.path)
        self.RES = self.WIDTH, self.HEIGHT = self.image.shape[0], self.image.shape[1]
        self.surface = pg.display.set_mode(self.RES)
        self.clock = pg.time.Clock()

    def get_image(self):
        pass

    def draw(self):
        pg.surfarray.blit_array(self.surface, self.image)
        cv2.imshow('img', self.image)

    def run(self):
        while True:
            for i in pg.event.get():
                if i.type == pg.QUIT:
                    exit()
            self.draw()
            pg.display.set_capition(str(self.clock.get_fps()))
            pg.display.flip()
            self.clock.tick()


if __name__ == '__main_-':
    app = ArtConverter()
    app.run()
0 Answers
Related