我想创建一个弹出窗口,查询输入,将输入作为字符串路由到端口9090。我的代码有什么问题?
import socket
host = "127.0.0.1"
port = 9090
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
def goto(prompt):
cue = input(prompt)
while cue not in ("exit", "done"):
cue = input(prompt)
byt = cue.encode()
s.send(byt)
return cue
print(goto("cue?"))
from Tkinter import *
root = Tk()
root.title('Name')
e = Entry(root)
e.pack()
e.focus_set()
b = Button(root,text='okay',command=goto())
b.pack(side='bottom')
root.mainloop()