[英]Lists in pgu/pygame
I'm searching for help about lists in pgu gui for pygame. 我正在寻找有关pygame的pgu gui中的列表的帮助。 I need to know which methods and properties they have, so I can include them in my programs 我需要知道它们具有哪些方法和属性,以便可以将其包含在程序中
My first suggestion 我的第一个建议
Use python's builtins to introspect on 使用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)
Always look at the source code, when it is available 始终查看源代码(如果可用)
From the code: You can create and clear a list. 通过代码:您可以创建和清除列表。
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>
"""
...
Usage : 用法:
# Create the actual widget
usagelist = gui.List(width, height)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.