尽管GP89似乎已经回答了这个问题,但我想我还是要多说一些细节。在
首先,GP89的建议是使用Python内置的^{} method。这是一种可以在交互式控制台中使用的方法。对于方法,它将打印方法的声明行以及类“docstring”(如果已定义)。您也可以使用.__doc__来访问它,例如:>>> def testHelp(arg1, arg2=0):
... """This is the docstring that will print when you
... call help(testHelp). testHelp.__doc__ will also
... return this string. Here is where you should
... describe your method and all its arguments."""
...
>>> help(testHelp)
Help on function testHelp in module __main__:
testHelp(arg1, arg2=0)
This is the docstring that will print when you
call help(testHelp). testHelp.__doc__ will also
return this string. Here is where you should
describe your method and all its arguments.
>>>
然而,对于理解方法、类和函数,另一个极其重要的工具是工具箱的API。对于内置的Python函数,应该检查Python Doc Library。我在那里找到了help()函数的文档。您使用的是wxPython,其API可以在here找到,因此可以快速搜索“wx.框架api“并且您可以发现this page describing all of ^{}'s methods and variables.不幸的是,CreatteToolBar()并不是特别好的文档,但是您仍然可以看到它的参数:CreateToolBar(self, style, winid, name)
编码快乐!在