フローティング連結ダイナミック テキスト ボックスをマップ レイアウトに追加するアドイン ボタンを ArcMap 10.2 で作成しています。私は自分のスクリプトに苦労しており、誰かが答えてくれることを望んでいます。
これが私のコードです:
def onClick(self):
mxd = arcpy.mapping.MapDocument("CURRENT")
for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", " ")[0]:
elmWidth = 4.0
x = 100
elm.text = 'User: <dyn type="user"/> Date: <dyn type="date" format="short"/> <Document Path: dyn type="document" property="path"/>'
elm.fontSize = x
while elm.elementWidth > float(elmWidth):
elm.fontSize = x
x = x-1
arcpy.RefreshActiveView()
del mxd
UnboundLocalError: local variable 'mxd' referenced before assignment および IndexError: list index out of range のエラーが発生します。
ありがとうございました。