Start New Discussion within our Software Development Community

What's Up?

OK, So my first Python script is still underway, Once a computer connects to the first script, we can then start sending text between them using a nice simple easygui. However after sending your specifed text once, It won't come back and ask you again.

#!/usr/bin/python
import socket
from easygui import *
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_socket.bind(("0.0.0.0", 5000))
server_socket.listen(5)
while 1:
        client_socket, address = server_socket.accept()
        incoming = client_socket.recv(512)
        print incoming
        button = buttonbox(msg='',choices=('Send','Button'),root=None)
        if ( button== 'Send'):
            data = enterbox(msg="Enter Text To Send")
        if ( button== 'Button'):
            print "Not ready yet"

It works once but then won't go back to the two button dialog again. How come?

See Ya!

I installed your program and easygui, but your program just seems to hang up without any gui comming up.

Seems to hang up with line 8:

Bound
Entering loop
#!/usr/bin/python
import socket
from easygui import *
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_socket.bind(("0.0.0.0", 5000))
print('Bound')
server_socket.listen(5)
print('Entering loop')
while 1:
        client_socket, address = server_socket.accept()
        print ('Getting incoming')
        incoming = client_socket.recv(512)
        print incoming
        print ('Starting gui')
        button = buttonbox(msg='',choices=('Send','Button'),root=None)
        if ( button== 'Send'):
            data = enterbox(msg="Enter Text To Send")
        if ( button== 'Button'):
            print "Not ready yet"

Program does not die when terminated, but must be terminated from task manager (I am using Windows XP)

This article has been dead for over six months. Start a new discussion instead.