Learn Python tkinter GUI mouse events easy 🖱️

preview_player
Показать описание
Python, mouse, event, bind, tkinter, GUI, tutorial, beginners,

#Python #mouse #event #bind #GUI #tkinter #tutorial #beginners
Рекомендации по теме
Комментарии
Автор

from tkinter import *

def doSomething(event):
print("Mouse coordinates: " + str(event.x)+", "+str(event.y))

window = Tk()

window.bind("<Button-1>", doSomething) #left mouse click
#window.bind("<Button-2>", doSomething) #scroll wheel
#window.bind("<Button-3>", doSomething) #right mouse click
#window.bind("<ButtonRelease>", doSomething)#mousebutton release
#window.bind("<Enter>", doSomething) #enter the window
#window.bind("<Leave>", doSomething) #leave the window
#window.bind("<Motion>", doSomething) #Where the mouse moved
window.mainloop()

BroCodez
Автор

Finally a guide that using just tkinter, thank you

chorus
Автор

this is so useful because when i make games i have re run and re run for a good location for things now i can just click there thanks bro

GamesLife-zyfg
Автор

This is exactly what I was looking for!

first_mm
Автор

Great! How do u bind mouse wheel with a scrollbar in the thinker pls??
Thanks for this tips👌🏾

funnyclips
Автор

left click and right click event working but scroll option not working

deepabiswas
welcome to shbcf.ru