Skip to content

Instantly share code, notes, and snippets.

@jasonblanchard
Created April 27, 2020 01:55
Show Gist options
  • Save jasonblanchard/043b66ac65e3fb4ee2197ca6c47b739e to your computer and use it in GitHub Desktop.
Save jasonblanchard/043b66ac65e3fb4ee2197ca6c47b739e to your computer and use it in GitHub Desktop.
import tkinter
def main():
root = tkinter.Tk()
canvas = tkinter.Canvas(root, width=200, height=100)
canvas.pack()
button = tkinter.Button(root, text="test")
button.bind("<Button-1>", lambda e: print("left clicked"))
button.bind("<Button-2>", lambda e: print("right clicked")) # Should print "right clicked" to the console. Change it to <Button-3> and it won't work
button.pack()
root.update()
root.mainloop()
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment