MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / FigureManagerWx

Class FigureManagerWx

lib/matplotlib/backends/backend_wx.py:962–1033  ·  view source on GitHub ↗

Container/controller for the FigureCanvas and GUI frame. It is instantiated by Gcf whenever a new figure is created. Gcf is responsible for managing multiple instances of FigureManagerWx. Attributes ---------- canvas : `FigureCanvas` a FigureCanvasWx(wx.Panel) ins

Source from the content-addressed store, hash-verified

960
961
962class FigureManagerWx(FigureManagerBase):
963 """
964 Container/controller for the FigureCanvas and GUI frame.
965
966 It is instantiated by Gcf whenever a new figure is created. Gcf is
967 responsible for managing multiple instances of FigureManagerWx.
968
969 Attributes
970 ----------
971 canvas : `FigureCanvas`
972 a FigureCanvasWx(wx.Panel) instance
973 window : wxFrame
974 a wxFrame instance - wxpython.org/Phoenix/docs/html/Frame.html
975 """
976
977 def __init__(self, canvas, num, frame):
978 _log.debug("%s - __init__()", type(self))
979 self.frame = self.window = frame
980 super().__init__(canvas, num)
981
982 @classmethod
983 def create_with_canvas(cls, canvas_class, figure, num):
984 # docstring inherited
985 wxapp = wx.GetApp() or _create_wxapp()
986 frame = FigureFrameWx(num, figure, canvas_class=canvas_class)
987 manager = figure.canvas.manager
988 if mpl.is_interactive():
989 manager.frame.Show()
990 figure.canvas.draw_idle()
991 return manager
992
993 @classmethod
994 def start_main_loop(cls):
995 if not wx.App.IsMainLoopRunning():
996 wxapp = wx.GetApp()
997 if wxapp is not None:
998 wxapp.MainLoop()
999
1000 def show(self):
1001 # docstring inherited
1002 self.frame.Show()
1003 self.canvas.draw()
1004 if mpl.rcParams['figure.raise_window']:
1005 self.frame.Raise()
1006
1007 def destroy(self, *args):
1008 # docstring inherited
1009 _log.debug("%s - destroy()", type(self))
1010 frame = self.frame
1011 if frame: # Else, may have been already deleted, e.g. when closing.
1012 # As this can be called from non-GUI thread from plt.close use
1013 # wx.CallAfter to ensure thread safety.
1014 wx.CallAfter(frame.Close)
1015 super().destroy()
1016
1017 def full_screen_toggle(self):
1018 # docstring inherited
1019 self.frame.ShowFullScreen(not self.frame.IsFullScreen())

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…