Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to use event of Button in python

import tkinter as tk
root = tk.Tk()
root.geometry("400x400")
frame = tk.Frame()
frame.master.title("UI PNC")
def XL(event):
    print("Position:", event.x,event.y)
canvas=tk.Canvas(frame)
canvas.create_rectangle(20,20,200,200,fill="red",tags="UI")
canvas.tag_bind("UI","<Button-3>",XL)
canvas.pack(expand=True, fill="both")
frame.pack(expand=True, fill="both")
root.mainloop()
Comment

PREVIOUS NEXT
Code Example
Python :: Printers Stampanti 
Python :: python script copy and paste 
Python :: Fancier Output Formatting in python 
Python :: Using np.unravel_index on argmax output 
Python :: currelation matrix python 
Python :: dataproc initialization_actions error 
Python :: starting point of loop linked list proof 
Python :: WAP THAT ASKS A USER FOR A NUMBER OF YEARS AND THEN PRINTS OUT THE NUMBER OF DAYS, HOURS ,MINUTES AND SECONDS IN THAT NO. OF YEARS. 
Python :: Random Hex Colors bar generator, python turtle 
Python :: substring in python 
Python :: python loop array 0,101/100 
Python :: interval time specification 
Python :: python inline web server 
Python :: python modules screen 
Python :: programação orientada a objetos python - Pessoa 
Python :: COMBINE TWO 2-D NUMPY ARRAYS WITH NP.VSTACK 
Python :: django queryset with multiple contain keyword 
Python :: how to search for element in list python 
Python :: concatenate the squares of numbers in python 
Python :: how to change a particular text inside a list of dictionary 
Python :: num1=int(self.t1.get()) 
Python :: spark group by alias 
Python :: django filter and condition 
Python :: Python Print Variable Using the + operator to join variables 
Python :: cannot access modules from neighbouring directories jupyter notebook 
Python :: Mastermind 
Python :: superpixel 
Python :: python image resize 
Python :: Reset Python Dictionary to 0 Zero. Empty existing Python Dictionary 
Python :: Finding the Sum of a Symmetrical Sub-List 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =