Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
Just curious, what's the use case for wanting to do this? – Derek Swingley Sep 28 '10 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 Sep 30 '10 at 3:36
up vote 8 down vote accepted
mxd = arcpy.mapping.MapDocument('CURRENT')
mxd.activeView = "my_data_frame_name"
share|improve this answer

To go the other way is as easy as:

arcpy.mapping.MapDocument("current").activeView = "PAGE_LAYOUT"
share|improve this answer
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 Feb 3 '11 at 13:39

Your Answer


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.