Every line of 'python tkinter button click event' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
12 def OnClick(self, event): 13 self.button.SetLabel("Clicked")
405 def bind_click(self, callback, button=1): 406 """ 407 Register a new callback that will be called whenever this 408 C{CanvasWidget} is clicked on. 409 410 @type callback: C{function} 411 @param callback: The callback function that will be called 412 whenever this C{CanvasWidget} is clicked. This function 413 will be called with this C{CanvasWidget} as its argument. 414 @type button: C{int} 415 @param button: Which button the user should use to click on 416 this C{CanvasWidget}. Typically, this should be 1 (left 417 button), 3 (right button), or 2 (middle button). 418 """ 419 self.__callbacks[button] = callback
24 def button_event(b, e, t): 25 print(b.label)
58 def buttonClick(element): 59 evt = doc().createEvent('MouseEvents') 60 mf = get_main_frame() 61 target = mf.EventTarget(element) 62 target.setptr(element.getptr()) # dreadful hack that actually works. wow. 63 evt.initMouseEvent("click", True, True, wnd(), 1, 0, 0, 0, 0, False, 64 False, False, False, 0, target) 65 element.dispatchEvent(evt)
184 def tk_mouse_button_release(self, event: tkinter.Event) -> None: 185 """Handle tkinter mouse press events. 186 187 Args: 188 event (tkinter.Event): The mouse button release event 189 """ 190 button = self._mouse_button_map.get(event.num) 191 if not button: 192 return 193 194 self._handle_mouse_button_state_change(button, False) 195 self._mouse_release_event_func(event.x, event.y, button)
32 def mouseAction(self, event): 33 if event.Entering(): 34 print 'enter' 35 self.bitmap = self.onbitmap 36 self.Refresh() 37 elif event.Leaving(): 38 self.bitmap = self.offbitmap 39 print 'leave' 40 self.Refresh() 41 elif event.ButtonUp(): 42 self.ClickedButton()
652 def press(self, event): 653 x, y = self.whichxy(event) 654 if x > 0 and y > 0: 655 self.setcurrent(x, y)
19 def on_left_mouse_release(self, event): 20 self.bind("", event)
435 def unbind_click(self, button=1): 436 """ 437 Remove a callback that was registered with C{bind_click}. 438 439 @type button: C{int} 440 @param button: Which button the user should use to click on 441 this C{CanvasWidget}. Typically, this should be 1 (left 442 button), 3 (right button), or 2 (middle button). 443 """ 444 try: del self.__callbacks[button] 445 except: pass
382 def MouseDown(self, evt): 383 self._selected = 1 384 #Custom event business 385 event = PSButtonEvent(myEVT_BTN_CLICKED, self.GetId()) 386 event._evt_obj = self 387 self.GetEventHandler().ProcessEvent(event) 388 wx.CallAfter(self.Refresh)