Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from Tkinter import *
- root=Tk()
- def enter():
- PORT=int(entry1.get())
- entry1.delete(0,END)
- HOST = 'localhost'
- BUFSIZ = 1024
- ADDR = (HOST,PORT)
- tcpCliSock = socket(AF_INET, SOCK_STREAM)
- tcpCliSock.connect(ADDR)
- def connection():
- txt.insert(END," \n > ")
- data = entry1.get()
- txt.insert(END,data)
- tcpCliSock.send(data)
- data = tcpCliSock.recv(1024)
- if not data:
- print"you are out, bye bye"
- txt.insert(END,"\n"+data)
- root.geometry("600x700+40+40")
- root.title("the client")
- txt=Text(root,bg="cyan",bd=8,width=60)
- txt.pack()
- entry1=Entry(root, font='Ariel 18',fg="black")
- entry1.pack(fill=X)
- btn1=Button(root,text=" Enter ",command=enter)
- btn1.pack()
- btn2=Button(root,text="Send ",command=connection)
- btn2.pack()
- menubar = Menu(root)
- filemenu= Menu(menubar,tearoff=0)
- filemenu.add_command(label="New")
- root.title("the client")
- menubar.add_cascade(label="File",menu=filemenu)
- helpmenu=Menu(menubar,tearoff=0)
- helpmenu.add_command(label="Send")
- menubar.add_cascade(label="Help",menu=helpmenu)
- aboutmenu=Menu(menubar,tearoff=0)
- aboutmenu.add_command(label="About me")
- aboutmenu.add_command(label="Version")
- menubar.add_cascade(label="About",menu=aboutmenu)
- root.config(menu=menubar)
- txt.insert(END,"please enter the port")
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement