如何解决在pygame中独立运行多个窗口
我查看了 pygame 中的多个窗口,发现这是不可能的,所以我尝试运行另一个脚本,例如。另一个单独的游戏。到目前为止,我是这样做的:
Main.py:
while running:
for event in pygame.event.get(): #Event loop
if event.type == pygame.QUIT:
running = False
if event.type == pygame.MOUSEBUTTONDOWN:
if event.button == 3: #Right click
os.system('python Character_sheet.py')
pygame.init()
screen = pygame.display.set_mode((int(1920/2),int(1080/2)))#Set display
running = True
while running:
clock.tick(fps)
screen.fill((255,0)) #Set background image
for event in pygame.event.get(): #Event loop
#Checks if quit,then quit
if event.type == pygame.QUIT:
running = False
if event.type == pygame.MOUSEBUTTONDOWN:
if event.button == 1:
print(":(")
#Update display
pygame.display.update()
我遇到的问题是,当我运行我的 Main.py 文件并右键单击窗口时,我必须等到单独的游戏 (Character_sheet.py) 关闭,这是有道理的。有没有办法独立于 Main.py 运行 Character_sheet.py,这样我就不必等到 Character_sheet.py 运行完毕?
感谢任何帮助,谢谢:)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。