Skip to content

Instantly share code, notes, and snippets.

@NotBobTheBuilder
Created August 4, 2013 15:08
Show Gist options
  • Save NotBobTheBuilder/6150618 to your computer and use it in GitHub Desktop.
Save NotBobTheBuilder/6150618 to your computer and use it in GitHub Desktop.
Tidied up version of @cymplecy's code
#Original Code Martin Bateman 2013
#Modified by Simon Walters
#GPLv2 applies
#PC End
#V0.2 04Aug13
import sys
import time
import socket
import Tkinter as Tk
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(('', 0))
s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
four_digits = "12aa"
if len(sys.argv) > 1:
message = sys.argv[1]
else:
message = "Start SID" + four_digits
def onOpen():
message = "Start SID" + four_digits
progress.set("New Text!")
for i in range(0,10):
s.sendto(message, ('<broadcast>', 50000))
time.sleep(2)
def onExit():
sys.exit()
root = Tk.Tk()
progress = Tk.StringVar(root)
root.title('Find a SID')
Tk.Label (text='enter the file name').pack(side=Tk.TOP,padx=10,pady=10)
Tk.Label (textvariable=progress).pack(side=Tk.TOP,padx=10,pady=10)
Tk.Entry(root, width=10).pack(side=Tk.TOP,padx=10,pady=10)
Tk.Button(root, text='open', command=onOpen).pack(side=Tk.LEFT)
#Button(root, text='exit').pack(side= RIGHT)
#Button(root, text='close').pack(side= RIGHT)
root.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment