matplotlib - python: how can I double left click to get a point in python -
i have map ,and want double left click zoom-in map , left click point.how should do? know 'ginput' command seems can't work double-left-click.
latsize=[39,45] lonsize=[-72.,-66] plt.figure(figsize=(7,6)) m = basemap(projection='cyl',llcrnrlat=min(latsize)-0.01,urcrnrlat=max(latsize)+0.01,\ llcrnrlon=min(lonsize)-0.01,urcrnrlon=max(lonsize)+0.01,resolution='h')#,fix_aspect=false) m.drawparallels(np.arange(int(min(latsize)),int(max(latsize))+1,1),labels=[1,0,0,0]) m.drawmeridians(np.arange(int(min(lonsize)),int(max(lonsize))+1,1),labels=[0,0,0,1]) plt.show()
i'm assuming you're using matplotlib? have register event handler mouse events. information need can found here:
look @ handling button_press_event
or button_release_event
. if follow link mouseevent class, you'll see has boolean double click indicator dblclick
.
here bare-bones example:
import matplotlib.pyplot plt def handle_mouse_press( event ): if event.dblclick: print "can haz dblclikz???" fig = plt.figure() fig.add_subplot(111) fig.canvas.mpl_connect('button_press_event', handle_mouse_press) plt.show()
Comments
Post a Comment