Try exploring the socket module. There is a wealth of info for it. I've successfully written a server and client script that works. I don't understand a whole lot, and know that I am only able to send string data. The module locale supports a way to "unpack" the data in the string aoti().
root = tkinter.Tk()
buttons=[i for i in range(10)]
#If specific button is pressed, output "YES"
for num in buttons: