本文整理汇总了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()