It looks like I have found a solution. I work for many hours on a problem
before posting so I am surprised I found this only one day after posting my
original question. I went digging in places I am not sure I should and came
with this command that appears to be a solution to my focus problem. It
would be nice to know from an expert if this the recommended method for
forcing focus in Matplotlib.

The command:
fig.canvas.get_tk_widget().focus_force()

My original demo code with the new command showing the focus behavior I
want:

import matplotlib.pyplot as plt
plt.ion()
fig = plt.figure(figsize=(10,8))
ax = fig.add_axes([.15,.1,.8,.65])
ax.plot([1,2,3])
ax.set_title('Fisrt Plot')
fig.canvas.get_tk_widget().focus_force()
raw_input('Enter to close and Continue: ')
#plt.close(fig)
fig2 = plt.figure(figsize=(10,8))
ax = fig2.add_axes([.15,.1,.8,.65])
ax.plot([1,2,3])
ax.set_title('Second Plot')
fig2.canvas.get_tk_widget().focus_force()
raw_input('Enter to close and Continue: ')
#plt.close(fig2)
fig.canvas.get_tk_widget().focus_force()
raw_input('Enter to close and Continue: ')

Bob Kestner



--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/Force-focus-on-Figure-tp39652p39654.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to