簡體   English   中英

有沒有辦法讓消息框顯示在 PyGame 窗口前?

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

對於學校,我們必須編寫這個愚蠢的僵屍游戲,但無論如何,到問題上。

我正在使用模塊 'ctypes' 在 python 中獲取消息框,但是每當我們使用它時,消息框都會顯示在 PyGame 窗口下方,這真的很煩人,因為我們必須單擊底部的選項卡並這只是一種美化的痛苦。 這是代碼:

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

這是一個要求拯救幸存者或放棄他們的提示,但消息框一直顯示在底部。 我可以應用某種參數將它放在 pygame 窗口前面嗎?

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