问题描述
您好!
如果我这样做
导入uno
localContext = uno.getComponentContext()
然后localContext的类型为< type''pyuno''>
我猜它是PyUNO扩展提供的新类型。
localContext .__ class__是无
有没有办法列出所有新类型的方法,通过Python C
API或通过解释器(除了dir之外) (localContext))?
我想要的是在教程中调用localContext的方法
例子:
x = MyClass()
MyClass.f(x)
谢谢,
Dmitri
Hello!
If I do
import uno
localContext=uno.getComponentContext()
then localContext is of type <type ''pyuno''>
I guess it''s a new type provided by PyUNO extension.
localContext.__class__ is None
Is there any way to list all methods of that new type, via Python C
API or through interpreter (other then dir(localContext) )?
What I want is to call localContext''s methods like in the tutorial
example:
x=MyClass()
MyClass.f(x)
Thank you,
Dmitri
推荐答案
'dir()`有什么问题?
What''s wrong about `dir()`?
我更喜欢::
x = MyClass()
xf()
I''d prefer::
x = MyClass()
x.f()
我想把指针指向Python在非Python应用程序中运行。
''dir()''需要一个参数,我希望得到函数指针
之前我有给定的变量类型或类。
这就是为什么''MyClass.f(x)''
I''mn反对''dir(MyClass)'';问题是,我应该得到什么(')''
来获取''pyuno''类型实例的方法?
真诚的你,
Dmitri
I want to cashe pointers to Python functions in a non-Python app.
''dir()'' requires an argument, and I want to get function pointers
before I have any variable of given type or class.
That''s why ''MyClass.f(x)''
I''m not against ''dir(MyClass)''; the question is, what should I ''dir()''
to get methods of ''pyuno'' type instance?
Sincerely yours,
Dmitri
通常实例没有自己的方法,他们从
类中获取它们。所以你实际上需要dir(MyClass)。
注意dir()可能不会显示所有可用的方法。
-
Gabriel Genellina
Usually instances don''t have its own methods, they get them from the
class. So you actually need dir(MyClass).
Note that dir() might not show all available methods.
--
Gabriel Genellina
这篇关于我如何获得类型方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!