pgu和Python中的列表

0 投票
1 回答
704 浏览
提问于 2025-04-16 06:18

我在寻找关于Python中pgu gui的列表的帮助。我想知道它们有哪些方法和属性,这样我才能把它们用到我的程序里。

1 个回答

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)

撰写回答