import wx class MainFrame(wx.Frame): def __init__(self, parent): super(MainFrame, self).__init__(parent) button = wx.Button(self, label="Mehet") button.Bind(wx.EVT_MOTION, self.on_motion_button) self.i=0 def on_motion_button(self, event): self.i+=1 print(self.i) class ValamiApp(wx.App): def OnInit(self): frame = MainFrame(None) frame.Show() return True app=ValamiApp() app.MainLoop()