简体   繁体   English

有没有办法让消息框显示在 PyGame 窗口前?

[英]Is there a way to make the message box show up in front of a PyGame Window?

For school, we have to code this dumb zombies game but whatever, onto the question.对于学校,我们必须编写这个愚蠢的僵尸游戏,但无论如何,到问题上。

I'm using the module 'ctypes' to get a message box in python but whenever we use it, the message box is showing up below the PyGame Window, which is really annoying, because we have to click on the tab at the bottom and it's just a glorified pain.我正在使用模块 'ctypes' 在 python 中获取消息框,但是每当我们使用它时,消息框都会显示在 PyGame 窗口下方,这真的很烦人,因为我们必须单击底部的选项卡并这只是一种美化的痛苦。 Here's the code:这是代码:

answer = ctypes.windll.user32.MessageBoxW(0, "Save survivor using ammo?", "Oh no, a zombie is approaching!", 4)
if answer == 6:
    survivor()
    ammo -= 1

It's a prompt that asks to save the survivor or abandon them, but the message box keeps showing up at the bottom.这是一个要求拯救幸存者或放弃他们的提示,但消息框一直显示在底部。 Is there some kind of parameter that I can apply that puts it in front of the pygame window?我可以应用某种参数将它放在 pygame 窗口前面吗?

MessageBox supports the uType flag MB_TOPMOST ( 0x00040000 ): MessageBox支持uType标志MB_TOPMOST0x00040000 ):

MB_YESNO = 4
MB_TOPMOST = 0x40000
uType = MB_YESNO | MB_TOPMOST
answer = ctypes.windll.user32.MessageBoxW(
    0, "Save survivor using ammo?", "Oh no, a zombie is approaching!", uType)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM