import wx class MainFrame(wx.Frame): def __init__(self, parent, title): super(MainFrame, self).__init__(parent, title=title) kep = wx.Bitmap("valami.png", wx.BITMAP_TYPE_ANY) self.bitmapButton = wx.BitmapButton(self, -1, kep) self.bitmapButton.Bind(wx.EVT_TOGGLEBUTTON, self.onClickToggle) vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(self.bitmapButton) self.SetSizer(vbox) self.Layout() def onClickToggle(self, event): # eredmény True vagy False allapot = event.GetEventObject().GetValue() print(allapot) class SimpleApp(wx.App): def OnInit(self): self.frame = MainFrame(None, title='váltógomb') self.frame.Show() return True app = SimpleApp() app.MainLoop()