本文整理匯總了Python中matplotlib.backends.backend_gtkagg.NavigationToolbar2GTKAgg.home方法的典型用法代碼示例。如果您正苦於以下問題:Python NavigationToolbar2GTKAgg.home方法的具體用法?Python NavigationToolbar2GTKAgg.home怎麽用?Python NavigationToolbar2GTKAgg.home使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類matplotlib.backends.backend_gtkagg.NavigationToolbar2GTKAgg
的用法示例。
在下文中一共展示了NavigationToolbar2GTKAgg.home方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: FindingChartDialog
# 需要導入模塊: from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg [as 別名]
# 或者: from matplotlib.backends.backend_gtkagg.NavigationToolbar2GTKAgg import home [as 別名]
#.........這裏部分代碼省略.........
on the APLpy plot. This marker disappears when the user clicks again,
so only one marker is displayed at all times. Clicks outside of the
plot (axes) are ignored. This method must be connected to the
Matplotlib event manager, which is part of the FigureCanvasBase.
"""
# The attribute 'button' from event is an integer. A left-click is
# mapped to 1, a middle-click to 2 and a right-click to 3. If we click
# outside of the axes: event.xdata and event.ydata hold the None value.
click = (event.xdata, event.ydata)
if event.button == 3 and None not in click:
# Get the alpha and delta for these x- and y-coordinates
coords = self.wcs.all_pix2world(event.xdata, event.ydata, 1)
star_id = self.db.star_closest_to_world_coords(*coords)[0]
# LEMONdB.get_star() returns (x, y, ra, dec, epoch, pm_ra, pm_dec, imag)
ra, dec = self.db.get_star(star_id)[2:4]
kwargs = dict(layer = self.MARKERS_LAYER,
edgecolor = 'red',
s = self.MARK_RADIUS)
self.aplpy_plot.show_markers(ra, dec, **kwargs)
self.selected_star_id = star_id
self.goto_button.set_sensitive(True)
# Pressing Enter activates 'Go to Star'
self.dialog.set_default_response(gtk.RESPONSE_APPLY)
def mark_star(self, star_id):
""" Mark a star in the finding chart.
Read from the LEMONdB the right ascension and declination of the star
whose ID is 'star_id' and overlay a green marker of radius MARK_RADIUS
on the APLpy plot. Any existing markers are removed. The original view
of the plot is restored (as if the user had clicked the 'Home' button
in the navigation toolbar), undoing any zooming and panning and taking
us to the first, default view of the FITS image.
"""
ra, dec = self.db.get_star(star_id)[2:4]
kwargs = dict(layer = self.MARKERS_LAYER,
edgecolor = '#24ff29',
s = self.MARK_RADIUS)
self.aplpy_plot.show_markers(ra, dec, **kwargs)
self.navig.home()
self.selected_star_id = star_id
self.goto_button.set_sensitive(True)
def goto_star(self):
""" Show the details of the selected star.
This method calls the parent LEMONdB.view_star() with the ID of the
star currently selected in the finding chart. It adds a notebook page
with the details of the star, or switches to it if it already exists.
"""
self.view_star(self.selected_star_id)
# Now pressing Enter closes the finding chart window
self.dialog.set_default_response(gtk.RESPONSE_CLOSE)
def hide(self):
""" Hide the GTk.Dialog """
self.dialog.hide()
self._currently_shown = False
def show(self):
""" Display the GTK.Dialog """
# Until a star is selected, Enter closes the window
self.dialog.set_default_response(gtk.RESPONSE_CLOSE)
self.dialog.show()
self._currently_shown = True
def is_visible(self):
""" Return True if the gtk.Dialog is shown, False if hidden """
return self._currently_shown
def on_delete_event(self, widget, event):
""" Callback handler for the 'delete-event' signal.
Closing a window using the window manager (i.e., clicking on the
window's close button), by default, causes it to be destroyed, so after
that there is nothing left to be redisplayed. Instead of destroying it,
hide the gtk.Dialog. Returns True in order to indicate that the default
handler is *not* to be called.
[http://faq.pygtk.org/index.py?req=show&file=faq10.006.htp]
"""
self.hide()
return True
def destroy(self):
""" Destroy the gtk.Dialog """
self.preferences_dialog.destroy()
self.dialog.destroy()