I am using Python 2.6 and ArcObjects in ArcGIS 10.0 to build and draw, among other things, graphic text on the current display. At one point I need to use the ITextSymbol.GetTextSize method. In a function called BuildSignGraphic() have the following:
def BuildSignGraphic(pFeature, annoFC):
.
.
pTextSymbol.GetTextSize(pDisplay.hDC, pDisplay.DisplayTransformation, txt, dblX, dblY)
.
.
When I run my code I get a name error:
NameError: global name 'dblX' is not defined
In VB.NET, the dblX variable would be explicitly declared, but Python doesn't do this. Because the dblX and dblY variables are input and get populated by the method, how do I go about defining these two variables so that Python can recognize them? This is an uncommon syntax for a method in ArcObjects, but I think it does occur elsewhere in ArcObjects.
Thanks in advance for the assistance.
Cheers, Ti
Answer
Out params behave differently in comtypes, they come in the return value of the call:
dblx, dbly = pTextSymbol.GetTextSize(pDisplay.hDC, pDisplay.DisplayTransformation, txt)
No comments:
Post a Comment