本文整理汇总了Python中matplotlib.backends.backend_wxagg.FigureCanvasWxAgg.get_default_filetype方法的典型用法代码示例。如果您正苦于以下问题:Python FigureCanvasWxAgg.get_default_filetype方法的具体用法?Python FigureCanvasWxAgg.get_default_filetype怎么用?Python FigureCanvasWxAgg.get_default_filetype使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_wxagg.FigureCanvasWxAgg
的用法示例。
在下文中一共展示了FigureCanvasWxAgg.get_default_filetype方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: BasePlotWindow
# 需要导入模块: from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.FigureCanvasWxAgg import get_default_filetype [as 别名]
#.........这里部分代码省略.........
return curr_dir
def SaveCurrentDirectory(self, curr_dir):
config = MicroViewSettings.MicroViewSettings.getObject()
config.CurrentSnapshotDirectory = curr_dir
def GetwlTableInvisible(self):
return self._wlTableInvisible
def CreateHighlightLookupTable(self):
# Create colour table for histogram overlay
table = vtk.vtkWindowLevelLookupTable()
table.SetSaturationRange(0, 0)
table.SetHueRange(0, 0)
table.SetValueRange(0, 1)
table.SetLevel(0.5)
table.SetWindow(1.0)
table.SetNumberOfColors(2)
table.SetTableValue(0, 0.0, 0.0, 0.0, 0.0)
table.SetTableValue(1, 1.0, 0.0, 0.0, 1.0)
table.Build()
return table
def GetInputName(self):
return self._inputname
def SetInputName(self, name):
self._inputname = name
def NotifyHistoHighlightChange(self):
event.notify(HistogramSelectionModifiedEvent(
self._select_x0, self._select_x1, self.GetHighlightVisible()))
def SelectionToROI(self):
"""Assert ourselves as the owner of the ROI object for this image"""
# This next line is increasingly not accurate - need something better
self._isROI = True
# send out a notification to allow any ROI visuals to modify themselves
event.notify(HistogramIsActiveROIEvent())
def GetROIType(self, index):
return 'custom'
def AutoThreshold(self, evt):
"""Force an autothreshold calculation
This routine posts an AutoThresholdCommandEvent command in order to request a new calculation of an
optimal Otsu threshold.
"""
event.notify(AutoThresholdCommandEvent())
def SetInput(self, inp):
if self.plot_data:
for p in self.plot_data:
p.remove()
self.plot_data = None
if self.data_markers:
self.data_markers.remove()
self.data_markers = None
self._plotData = inp
# bit of a bad name -- this next line actually resets all inputs, then
# adds self._plotData
self.SetHighlightVisible(False)
def SaveSnapShot(self, evt):
# Fetch the required filename and file type.
filetypes, exts, filter_index = self.canvas._get_imagesave_wildcards()
default_file = "image." + self.canvas.get_default_filetype()
dlg = wx.FileDialog(self, "Save snapshot to file", "", default_file,
filetypes,
wx.SAVE | wx.OVERWRITE_PROMPT)
dlg.SetFilterIndex(filter_index)
if dlg.ShowModal() == wx.ID_OK:
dirname = dlg.GetDirectory()
filename = dlg.GetFilename()
format = exts[dlg.GetFilterIndex()]
basename, ext = os.path.splitext(filename)
if ext.startswith('.'):
ext = ext[1:]
if ext in ('svg', 'pdf', 'ps', 'eps', 'png') and format != ext:
# looks like they forgot to set the image type drop
# down, going with the extension.
dlg = wx.MessageDialog(self, 'extension %s did not match the selected image type %s; going with %s' %
(ext, format, ext), 'Warning', wx.OK | wx.ICON_WARNING)
dlg.ShowModal()
dlg.Destroy()
format = ext
try:
self.canvas.print_figure(
os.path.join(dirname, filename), format=format)
except Exception, e:
logging.error(e.message)