I can not cycle while on Tkinter (Python 2.7)

0

I'm doing a simple server application using sockets, using a command of a Button should call the function to listen to the customers but it stays stuck.

from Tkinter import *
import socket


def listen():
  global s
  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  s.bind(("", 9999))
  s.listen(5)
  global c
  c = None
  while True:
     if c is None:
     box.insert(END,'[Esperando conexion...]')
     box.see(END)
     c, addr = s.accept()
     box.insert(END,'Conexion establecida desde: '+addr)
     box.see(END)
ventsv = Tk()
ventsv.title("Server")
ventsv.geometry("600x310")
box = Listbox(ventsv, width=80,height=10)
conxsv =Button(ventsv, text = 'BUSCAR CLIENTE',command=listen, background 
='SteelBlue1',width =22)
box.place(x=50,y=70)
conxsv.place(x=370,y=30)
ventsv.mainloop ()
    
asked by wlmraziel 03.08.2017 в 04:43
source

0 answers