legend element issue

Discussion created by ryankelley001 on Apr 11, 2012
Latest reply on Apr 12, 2012 by jbarrette-esristaff
I have been working on a script to fit dynamic legends on the second page of a pdf. However, the legend seems to place incorrectly when I run the code.  I was writing some functions to deal with each size template... but am wondering if this is a bug or I am just using this code incorrectly.  In my script I am deleting all var's at the end and this still happens.

I stripped it down and this behavior also exists in "CURRENT" as well. Copy/paste a few times in in a row in the arcpy window and you'll see what I mean. The legend's placement and columns toggle back and forth. Perhaps if I can understand why this is happening, it may help me understand the specific issues of my script.

import arcpy
legend = MAP.ListLayoutElements(MXD, "LEGEND_ELEMENT", "Legend")[0]
legend.elementHeight = 10
legend.elementWidth = 16
legend.elementPositionX = .6
legend.elementPositionY = .5