Please ignore my english mistakes*
I'm trying to use pygame and flask as if it were a server I want to use pygame to return a message on the site but it's giving an error that I don't understand
from flask import Flask, render_template
import pygame
import sys
from pygame.locals import *
from multiprocessing import Process, Value
pygame.init()
screen_max = ((1152, 648))
screen = pygame.display.set_mode((screen_max), pygame.FULLSCREEN | pygame.SCALED)
app = Flask(__name__)
def Game_loop():
global screen_max, screen
while True:
screen.fill([255, 255, 255])
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
if event.type == pygame.MOUSEBUTTONDOWN:
@app.route('/')
def homepage():
return "holding"
if event.type == pygame.MOUSEBUTTONUP:
@app.route('/')
def homepage():
return "loose"
if __name__ == '__main__':
p = Process(target=Game_loop)
p.start()
app.run(host='0.0.0.0', port=5000, debug=True)
p.join()
And it's giving this error when I exit the project:
Traceback (most recent call last):
File "/storage/emulated/0/Download/server/main.py", line 32, in <module>
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/flask/app.py", line 909, in run
cli.show_server_banner(self.env, self.debug, self.name, False)
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/flask/cli.py", line 649, in show_server_banner
click.echo(message)
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/click/utils.py", line 299, in echo
file.write(out) # type: ignore
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/click/_compat.py", line 108, in __getattr__
return getattr(self._stream, name)
AttributeError: 'str' object has no attribute 'write'
The screen is not even white by the code line screen.fill
I don't know if this is a problem with the multiprocessing module or a conflict with pygame