我正在制作一款游戏,需要能够在pygame表面中弹出gui元素.这个问题不是我想要的,因为wxPython绕过SDL表面而不是它内部.到目前为止,我只在这个问题空间中看过ocemp,pgu和GooeyPy.
因此,我的问题是:我应该使用什么gui工具包来制作pygame应用程序中的可点击按钮?有没有积极的发展?
编辑,2011年9月
看起来PGU仍在维护中.最后一次提交是从4天前开始的.
我想在我在Tkinter中制作的GUI中使用pygame(精灵图形)中的一些功能.我知道OcempGUI,但我更喜欢坚持使用Tkinter,只需使用pygame中的一些模块.这类似但不完全相同.这有可能吗?什么是潜在的问题(事件循环)?
我想在 pygame 中创建一个菜单栏,就像 tkinter 中的菜单栏一样。
from tkinter import *
def donothing():
filewin = Toplevel(root)
button = Button(filewin, text="Do nothing button")
button.pack()
root = Tk()
menubar = Menu(root)
filemenu = Menu(menubar, tearoff=0)
filemenu.add_command(label="New", command=donothing)
filemenu.add_command(label="Open", command=donothing)
filemenu.add_command(label="Save", command=donothing)
filemenu.add_command(label="Save as...", command=donothing)
filemenu.add_command(label="Close", command=donothing)
filemenu.add_separator()
filemenu.add_command(label="Exit", command=root.quit)
menubar.add_cascade(label="File", menu=filemenu)
editmenu = Menu(menubar, tearoff=0)
editmenu.add_command(label="Undo", command=donothing)
editmenu.add_separator()
editmenu.add_command(label="Cut", command=donothing)
editmenu.add_command(label="Copy", command=donothing)
editmenu.add_command(label="Paste", command=donothing)
editmenu.add_command(label="Delete", command=donothing)
editmenu.add_command(label="Select All", command=donothing)
menubar.add_cascade(label="Edit", menu=editmenu)
helpmenu = Menu(menubar, tearoff=0)
helpmenu.add_command(label="Help Index", command=donothing)
helpmenu.add_command(label="About...", command=donothing)
menubar.add_cascade(label="Help", menu=helpmenu)
root.config(menu=menubar)
root.mainloop() …Run Code Online (Sandbox Code Playgroud)