代码之家  ›  专栏  ›  技术社区  ›  Carlos

pgu/pygame中的列表

  •  0
  • Carlos  · 技术社区  · 14 年前

    我正在为Pygame搜索有关PGU GUI中列表的帮助。我需要知道它们有哪些方法和属性,以便在我的程序中包含它们

    1 回复  |  直到 14 年前
        1
  •  0
  •   pyfunc    14 年前

    我的第一个建议

    使用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)
    
    推荐文章