Python 类在pygame中更改屏幕大小
我构建了两个类只是为了检查一些东西Python 类在pygame中更改屏幕大小,python,pygame,Python,Pygame,我构建了两个类只是为了检查一些东西 如果我有一个a级,它只运行pygame并打开一个新窗口,比如600X600 然后打开运行相同的类B,调用以构建新的显示 800X800,如果我们创建a的新实例,屏幕将更改为a的大小 A: B: 我如何不让A改变B的屏幕 pygame.display.set_mode仅设置分辨率并返回曲面,因此调用两次将返回新曲面并更改窗口分辨率 pygame中不可能同时有两个显示,但是您可以调用另一个脚本来打开另一个进程(因此是另一个显示) import pygame c
如果我有一个a级,它只运行pygame并打开一个新窗口,比如600X600 然后打开运行相同的类B,调用以构建新的显示 800X800,如果我们创建a的新实例,屏幕将更改为a的大小 A: B:
我如何不让A改变B的屏幕
pygame.display.set_mode
仅设置分辨率并返回曲面,因此调用两次将返回新曲面并更改窗口分辨率
pygame中不可能同时有两个显示,但是您可以调用另一个脚本来打开另一个进程(因此是另一个显示)
import pygame
class A:
def __init__(self):
pygame.init()
self.flag = True
def start(self):
self.disp = pygame.display.set_mode((500,500))
while self.flag:
for event in pygame.event.get():
if event.type == pygame.QUIT:
self.flag = False
pygame.display.update()
from A import A
import pygame
pygame.init()
displ = pygame.display.set_mode((800,800))
exited = False
while not exited:
for event in pygame.event.get():
if event.type == pygame.QUIT:
exited = True
newA = A()
newA.start()