9

Is there a way to change from layout view to data view using Python and ArcMap 10?

I would prefer to do it using ArcPy.

2
  • Just curious, what's the use case for wanting to do this? Commented Sep 28, 2010 at 22:43
  • I originally wanted to do this because in ArcMap 10 the buttons to switch to layout or data view disappear sometimes. I thought I could simply change it using Python, but I still haven't been able to. It's not a solution to the problem, but I was more interested in learning how to do this in python anyway.
    – Tanner
    Commented Sep 30, 2010 at 3:36

2 Answers 2

9
mxd = arcpy.mapping.MapDocument('CURRENT')
mxd.activeView = "my_data_frame_name"
arcpy.RefreshActiveView()
0
8

To go the other way is as easy as:

arcpy.mapping.MapDocument("current").activeView = "PAGE_LAYOUT"
1
  • Thank you. I see the mention of "PAGE_LAYOUT" now in the online documentation. I appreciate you pointing this out. It's the last thing I needed for porting a 60-page mapping tool written in VBA and ArcObjects to a 10-page tool written with Python and arcpy. Plus, I can also take advantage of data driven pages. Thanks again!
    – user1853
    Commented Feb 3, 2011 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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