import socket from tkinter import * from tkinter import messagebox #IP="127.0.0.1" PORT = 5050 BUFSIZ = 2048 def true(): print("xD") def false(): print("xD2") def test(x): switcher == { True: true(), False: false(), } return switcher.get(x, "nothing") def shutdown(): return os.system("shutdown /s /t 1") def connect_1(): while True: IP = txtfld.get() client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client_addr = (IP, PORT) try: client.connect(client_addr) messagebox.showinfo("Info","Connected!!") break except: messagebox.showinfo("Info","Error connecting to server") break window=Tk() txtfld=Entry(window,bd=2,width=41) txtfld.place(x=15, y=10) btn=Button(window, text="Connect", fg='black',command=connect_1,width=10) btn.place(x=280, y=10) btn_1=Button(window,text="Exit",fg='black',command=quit,height=5,width=10) btn_1.place(x=280,y=200) btn_2=Button(window,text="Process\n Running",fg='black',height=15,width=10) btn_2.place(x=15,y=50) btn_3=Button(window,text="App Running",fg='black',height=5,width=22) btn_3.place(x=105,y=50) btn_4=Button(window,text="Shut\ndown",fg='black',height=3,width=5) btn_4.place(x=105,y=140) btn_5=Button(window,text="Screenshot",fg='black',height=3,width=15) btn_5.place(x=155,y=140) btn_6=Button(window,text="Registry Fix",fg='black',height=5,width=22) btn_6.place(x=105,y=200) btn_7=Button(window,text="Key\nstroke",fg='black',height=9,width=10) btn_7.place(x=280,y=50) window.title('IP Connect') window.geometry("370x300") window.mainloop()