Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- import socket
- from threading import Thread
- def host():
- sock = socket.socket()
- sock.connect(('localhost', 9090))
- sock.send("change".encode())
- sock.close()
- window = Tk()
- def handle_click(event):
- th = Thread(target=host)
- th.start()
- window.geometry("300x300")
- window.columnconfigure(1, weight=1, minsize=75)
- window.rowconfigure(1, weight=1, minsize=50)
- frm = Frame(master=window, relief=RAISED, borderwidth=5)
- frm.grid(row=1, column=1)
- btn = Button(master=frm, text="Change", background="#28AFEA")
- btn.grid(row=1, column=1)
- btn.bind("<Button-1>", handle_click)
- window.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment