Created
March 10, 2018 16:34
-
-
Save Zemaaan/afa9dc6664e130e483210ff0dc29fafa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
import Tkinter as tkinter # for Python 2 | |
except ImportError: | |
import tkinter # for Python 3 | |
def on_click_1(): | |
print("First handler fired") | |
def on_click_2(): | |
print("Second handler fired") | |
tk = tkinter.Tk() | |
myButton = tkinter.Button(tk, text="Click Me!") | |
myButton.pack() | |
# this first add is not required in this example, but it's good form. | |
myButton.bind("<Button>", on_click_1, add="+") | |
# this add IS required for on_click_1 to remain in the handler list | |
myButton.bind("<Button>", on_click_2, add="+") | |
tk.mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment