| Updated on | |
Python Example Network Socket Script with a Tkinter GUIisup.py makes use of tkinter and sockets.Python Code
#!/usr/local/bin/python
# Python Sockets and Tkinter Example Script 1.0
# Author: Douglas Palovick
# License: GPL http://www.gnu.org/licenses/gpl.txt
import socket
import Tkinter
import tkMessageBox
def ifup():
testConn = socket.socket(socket.AF_INET,
socket.SOCK_STREAM)
try:
# customize as needed, change the server
# or edit the code to try multiple
# reliable internet servers
testConn.connect(('yahoo.com', 80))
#print "yep"
tkMessageBox.showinfo('CONNECTION BOX',
'YES! YOU ARE CONNECTED TO THE INTERNET')
testConn.close()
except:
#print "nope"
tkMessageBox.showinfo('CONNECTION BOX',
'NO CONNECTION')
testConn.close()
ifup()
|