Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

Out params behave differently in comtypes, they come in the return value of the call:

dblx, dbly = pTextSymbol.GetTextSize(pDisplay.hDC, pDisplay.DisplayTransformation, txt)
share|improve this answer
    
Thank you so much, Jason. I have learned something new today. Happy New Year! –  celticflute Jan 10 '11 at 4:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.