hi ,
i need to add hide button in canvas i the same panel how can i do that how i can have space to add the button ?
i have no idea if is possible to add button in two canvas button ’ plot" like the picture :
that is my code with 2 panels and 2 canvas
import wx
from numpy import arange, sin, pi,cos
import numpy as np
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
from matplotlib.widgets import RectangleSelector
from matplotlib.figure import Figureclass MainFrame(wx.Frame):
def init(self, parent ):
wx.Panel.init(self, parent,name=“Main”, size = (600,800))
Top = PanelTop(self)
Bottom = PanelBottom(self)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(Top, 1, wx.EXPAND)
sizer.Add(Bottom, 1, wx.EXPAND)
self.SetSizer(sizer)class PanelTop(wx.Panel):
def init(self,parent):
wx.Panel.init(self,parent,size = (300,300))
self.SetBackgroundColour(‘white’)
self.figure = Figure(figsize = (4,5))
self.axes = self.figure.add_subplot(111)
self.canvas = FigureCanvas(self,-1,self.figure)
self.sizer = wx.BoxSizer(wx.VERTICAL)
self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
self.SetSizer(self.sizer)t = arange(0.5, 3.0, 0.01) s = cos(2 * pi * t) self.axes.plot(t, s)
class PanelBottom(wx.Panel):
def init(self,parent):
wx.Panel.init(self, parent, size = (300,300))
self.SetBackgroundColour(‘grey77’)
self.figure = Figure(figsize = (4,5))
self.axes = self.figure.add_subplot(111)
self.canvas = FigureCanvas(self,-1,self.figure)
self.sizer = wx.BoxSizer(wx.VERTICAL)
self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
self.SetSizer(self.sizer)t = arange(0.0, 3.0, 0.01) s = sin(2 * pi * t) self.axes.plot(t, s)
app = wx.App()
frame = MainFrame(None).Show()
app.MainLoop()
thank you