问题描述
我查看了 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 (将#修改为@)