from tkinter import *
import urllib.request
 
 
def setGreen():
    print("Available")
    urllib.request.urlopen("http://busylight.lan/?=GREEN").read()
    root.configure(bg='green')

def setYellow():
    print("Busy")
    urllib.request.urlopen("http://busylight.lan/?=YELLOW").read()
    root.configure(bg='yellow')
    
def setRed():
    print("Do Not Disturb")
    urllib.request.urlopen("http://busylight.lan/?=RED").read()
    root.configure(bg='red')
    
def setOff():
    print("Light Off")    
    urllib.request.urlopen("http://busylight.lan/?=OFF").read()
    root.configure(bg='white')
 
root = Tk()
root.geometry("200x150")
root.iconbitmap(r'H:\My Documents\BusyLight\StopIcon.ico') 


frame = Frame(root)
frame.pack()
buttonGreen = Button(frame, bg = "Green", text = "Green", command = setGreen, width = 7)
buttonYellow = Button(frame, bg = "Yellow", text = "Yellow", command = setYellow, width = 7)
buttonRed = Button(frame, bg = "Red", text = "Red", command = setRed, width = 7)
buttonOff = Button(frame, text = "Off", command = setOff, width = 7)
buttonGreen.pack()
buttonYellow.pack()
buttonRed.pack()
buttonOff.pack()


root.title("BusyGUI")
root.mainloop()