IPictureDisp python

时间:2017-01-05 15:28:00

标签: python-2.7 pywin32

我尝试用python语言编写com addIn for Inventor。除ControlDefinitions.AddButtonDefinition方法外,一切正常,需要IPictureDisp类型的图像。

如何在python中获取此类型的图像?

这是方法签名

Sub AddButtonDefinition(DisplayName As String, InternalName As String, Classification As CommandTypesEnum, ByRef ClientId As [optional] VARIANT, ByRef DescriptionText As [defaultvalue("")] BSTR, ByRef TooltipText As [defaultvalue("")] BSTR, ByRef StandardIcon As [optional] VARIANT, ByRef LargeIcon As [optional] VARIANT, ByRef ButtonDisplay As [defaultvalue(kDisplayTextInLearningMode)] ButtonDisplayEnum, Result As [out, retval] ButtonDefinition*)

这是教程中的代码示例

Dim oControlDefinitions As ControlDefinitions
Set oControlDefinitions = oApp.CommandManager.ControlDefinitions

Dim oLargeIcon As IPictureDisp
Dim oSmallIcon As IPictureDisp
Set oLargeIcon = LoadPicture(App.Path & "\Large.ico")
Set oSmallIcon = LoadPicture(App.Path & "\Small.ico")

Set oButtonDefinition = oControlDefinitions.AddButtonDefinition( _
  "Display Name", "invrSampleCommand", _
  kShapeEditCmdType, "CLSID of the AddIn", _
  "Description Text", "Tooltip", _
  oSmallIcon, oLargeIcon, _
  kDisplayTextInLearningMode)

0 个答案:

没有答案