Wherever the code is run.
So, unless you use .net remoting for a windows/mono app then most likely its on the client. But if you're talking asp.net (theres a forum for that) it would be the server end..
root = tkinter.Tk()
buttons=[i for i in range(10)]
#If specific button is pressed, output "YES"
for num in buttons: