使用带有窗口菜单元素的 pyGame 的 Python 游戏 [英] Python Game using pyGame with Window Menu elements

查看:49
本文介绍了使用带有窗口菜单元素的 pyGame 的 Python 游戏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是交易.我正在尝试编写一个打砖块克隆游戏,问题是我需要一个像你在 pyGTK 中那样的窗口菜单.例如 File->(Open/Save/Exit) .. 类似的东西,并打开一个关于"上下文,作者应该被写入.

Here's the deal. I'm trying to write an arkanoid clone game and the thing is that I need a window menu like you get in pyGTK. For example File->(Open/Save/Exit) .. something like that and opening an "about" context where the author should be written.

我已经在使用 pyGame 来编写游戏逻辑.我试过用 pgu 来编写 GUI,但这对我没有帮助,尽管它有我正在考虑的那些菜单元素,但你不能在它的容器中包含游戏的屏幕.

I'm already using pyGame for writting the game logic. I've tried pgu to write the GUI but that doesn't help me, altough it has those menu elements I'm taking about, you can't include the screen of the game in it's container.

有谁知道如何在 pyGame 的使用中包含这样的窗口菜单?

Does anybody know how to include such window menus with the usage of pyGame ?

推荐答案

wxPython 允许您将 Pygame 窗口集成到普通"wxPython 窗口中 - 查看他们的 wiki 条目 了解如何操作.这应该允许你有一个普通的窗口(带有文件/帮助/等)菜单,但有一个 Pygame 表面,你可以为你的游戏绘制.

wxPython allows you to integrate a Pygame window inside of a "normal" wxPython window - check out their wiki entry for how to do it. This should allow you to have a normal window (with File/Help/etc.) menus, but have a Pygame surface to which you can draw for your game.

这篇关于使用带有窗口菜单元素的 pyGame 的 Python 游戏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆