我正在寻找有关pygame的pgu gui列表的帮助。我需要知道他们有哪些方法和属性,所以我可以将它们包含在我的程序中
答案 0 :(得分:0)
我的第一个建议
使用python的内置来反省
import pgu.gui.List
import inspect
help(pgu.gui.List) # to read out the doc strings
print dir(pgu.gui.List) # to get the namespace of List class
# to get all methods of that class
all_functions = inspect.getmembers(pgu.gui.List, inspect.isfunction)
始终查看源代码(如果可用)
从代码中:您可以创建并清除列表。
class List(ScrollArea):
"""A list of items in an area.
<p>This widget can be a form element, it has a value set to whatever item is selected.</p>
<pre>List(width,height)</pre>
"""
....
def clear(self):
"""Clear the list.
<pre>List.clear()</pre>
"""
...
用法:
# Create the actual widget
usagelist = gui.List(width, height)