In my code, I've created StatusBar self.CreateStatusBar()
. I can use this statusbar in MenuItem
. Like Below:
How can I use this statusbar in Button. Like, when I will enter my mouse over button, I will use this statusBar to give information about that button.
import wx
class MyFrame(wx.Frame):
def __init__(self, *args, **kw):
super(MyFrame, self).__init__(*args, **kw)
self.Init()
def Init(self):
panel = wx.Panel(self)
button = wx.Button(panel, label='Button', pos=(30, 25))
button.Bind(wx.EVT_ENTER_WINDOW, self.OnMouseEnter)
button.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeave)
self.StatusBar = self.CreateStatusBar()
self.SetSize((200, 170))
self.SetTitle('Statusbar...')
self.Centre()
self.Show(True)
def OnMouseEnter(self, e):
self.StatusBar.SetStatusText("Mouse Enter Event...")
e.Skip()
def OnMouseLeave(self, e):
self.StatusBar.SetStatusText("Mouse Leave Event...")
e.Skip()
def Main():
app = wx.App()
MyFrame(None)
app.MainLoop()
if __name__ == '__main__':
Main()