使用 tkinter 后 Pygame 窗口不会移动或关闭 [英] Pygame window wont move or close after using tkinter
问题描述
我已经在许多不同的项目中遇到这个问题多年了,所以我真的很想知道如何解决它.例如,在我的一个项目中,我为游戏创建了一个关卡编辑器.关卡编辑器可以选择使用 tkinter.filedialog
从文件中保存和加载不同的关卡.
I have had this problem for ages now with many different projects now, so I really want to find out how to fix it. For example, in one of my projects, I created a level editor for a game. The level editor had the option to save and load different levels from a file using tkinter.filedialog
.
现在我选择文件后,游戏仍然可以运行,但X"关闭按钮不再起作用,而且我无法移动窗口.
Now after I select the file, the game will still work, but the 'X' close button doesn't work anymore, and I can't move the window.
游戏本身照常运行,我仍然可以与窗口内的所有内容进行交互,但无法移动或关闭窗口.
The game itself works as usual, and I can still interact with everything inside of the window, but I can't move or close the window.
提前致谢,丹尼尔
(P.S.我不是新投稿,只是忘记了旧账号的用户名和密码XD)
(P.S. I am not a new contributor, I just forgot the username and password from my old account XD)
推荐答案
好的.我想通了这一点.当我通过按键而不是鼠标按键调用 tkinter 函数时,问题就消失了.
Ok. I figured this one out. The problem went away when I called the tkinter functions from a key press, not a mouse press.
这篇关于使用 tkinter 后 Pygame 窗口不会移动或关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!