The script that I'm writing repositions two data frames and sets their extents. When doing this, it redraws the entire Active View 4 times, slowing the script substantially. Pressing F9 or clicking the 'Pause Drawing' button before running the script disables the drawing and makes the script run much faster, but I want the script to do this automatically. I want to disable drawing at the beginning of the script, and enable it at the end. How do I do this?
I didn't see anything native in ArcPy. The easiest thing to do is probably send the F9 keystroke to the ArcMap window using the SendKeys module: http://www.rutherfurd.net/python/sendkeys/#dowloads
I tested with this syntax and it worked fine:
The only caveat is that you may need to uncheck "Always run in foreground" on the General tab of the script properties. Otherwise the keystroke may get caught by the script progress window.