from tkinter import *
import socket
def runningServ( event) :
winConnect.insert ( 1.0 , "running\n " )
hostStr= host.get ( )
portInt= port.get ( )
mainSocket.bind ( ( hostStr, portInt) )
mainSocket.listen ( 4 )
while True :
conn, addr = mainSocket.accept ( )
data = conn.recv ( 1024 )
winConnect.insert ( 'connect: ' +str ( addr) )
mainSocket= socket .socket ( )
root= Tk( )
root.title ( "server setting" )
lab0= Label( root, text= 'Host: ' )
host= StringVar( )
host.set ( '' )
fieldHost= Entry( root, width= 20 , textvariable= host)
lab0.grid ( row= 2 , column= 2 )
fieldHost.grid ( row= 2 , column= 3 )
lab1= Label( root, text= 'Port: ' )
port= IntVar( )
port.set ( 9090 )
fieldPort= Entry( root, width= 20 , textvariable= port)
lab1.grid ( row= 4 , column= 2 )
fieldPort.grid ( row= 4 , column= 3 )
winConnect= Text( root, width= 20 , height= 5 )
winConnect.grid ( row= 6 , column= 3 )
scr = Scrollbar( root, command= winConnect.yview )
winConnect.configure ( yscrollcommand= scr.set )
#winConnect.insert(1.0,"running\n")
scr.grid ( row= 6 , column= 4 )
butt= Button( root, text= 'Running' )
butt.grid ( row= 7 , column= 2 )
butt.bind ( "<Button-1>" , runningServ)
root.mainloop ( )
ZnJvbSB0a2ludGVyIGltcG9ydCAqCmltcG9ydCBzb2NrZXQKCmRlZiBydW5uaW5nU2VydihldmVudCk6CiAgICAgICAgCgl3aW5Db25uZWN0Lmluc2VydCgxLjAsInJ1bm5pbmdcbiIpCiAgICAgICAgCglob3N0U3RyPWhvc3QuZ2V0KCkKCXBvcnRJbnQ9cG9ydC5nZXQoKQoJCgltYWluU29ja2V0LmJpbmQoKGhvc3RTdHIsIHBvcnRJbnQpKQoJbWFpblNvY2tldC5saXN0ZW4oNCkKCQoJd2hpbGUgVHJ1ZToKCQljb25uLCBhZGRyID0gbWFpblNvY2tldC5hY2NlcHQoKQoJCWRhdGEgPSBjb25uLnJlY3YoMTAyNCkKCQl3aW5Db25uZWN0Lmluc2VydCgnY29ubmVjdDogJytzdHIoYWRkcikpCgptYWluU29ja2V0PXNvY2tldC5zb2NrZXQoKQpyb290PVRrKCkKcm9vdC50aXRsZSgic2VydmVyIHNldHRpbmciKQoKbGFiMD1MYWJlbChyb290LCB0ZXh0PSdIb3N0OiAnKQpob3N0PVN0cmluZ1ZhcigpCmhvc3Quc2V0KCcnKQpmaWVsZEhvc3Q9RW50cnkocm9vdCwgd2lkdGg9MjAsIHRleHR2YXJpYWJsZT1ob3N0KQpsYWIwLmdyaWQocm93PTIsY29sdW1uPTIpCmZpZWxkSG9zdC5ncmlkKHJvdz0yLGNvbHVtbj0zKQoKbGFiMT1MYWJlbChyb290LCB0ZXh0PSdQb3J0OiAnKQpwb3J0PUludFZhcigpCnBvcnQuc2V0KDkwOTApCmZpZWxkUG9ydD1FbnRyeShyb290LCB3aWR0aD0yMCwgdGV4dHZhcmlhYmxlPXBvcnQpCmxhYjEuZ3JpZChyb3c9NCxjb2x1bW49MikKZmllbGRQb3J0LmdyaWQocm93PTQsY29sdW1uPTMpCgp3aW5Db25uZWN0PVRleHQocm9vdCx3aWR0aD0yMCwgaGVpZ2h0PTUpCndpbkNvbm5lY3QuZ3JpZChyb3c9Nixjb2x1bW49MykKc2NyID0gU2Nyb2xsYmFyKHJvb3QsY29tbWFuZD13aW5Db25uZWN0Lnl2aWV3KQp3aW5Db25uZWN0LmNvbmZpZ3VyZSh5c2Nyb2xsY29tbWFuZD1zY3Iuc2V0KQojd2luQ29ubmVjdC5pbnNlcnQoMS4wLCJydW5uaW5nXG4iKQpzY3IuZ3JpZChyb3c9Nixjb2x1bW49NCkKCmJ1dHQ9QnV0dG9uKHJvb3QsdGV4dD0nUnVubmluZycpCmJ1dHQuZ3JpZChyb3c9Nyxjb2x1bW49MikKYnV0dC5iaW5kKCI8QnV0dG9uLTE+IixydW5uaW5nU2VydikKCnJvb3QubWFpbmxvb3AoKQ==
stdout
stderr
Traceback (most recent call last):
File "./prog.py", line 20, in <module>
File "/usr/lib/python3.4/tkinter/__init__.py", line 1854, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable