import tkinter

class Globals:
    window = None
    valueLabel = None
    valueSlider = None
    choiceVar = None

def sliderChanged(event):
   newValue = Globals.valueSlider.get()
   Globals.valueLabel.configure(text = str(newValue))
      

def radioButtonChosen():
    if Globals.choiceVar.get() == 1:
        Globals.valueSlider.configure(from_=-100, to=100)
    else:
        Globals.valueSlider.configure(from_=-10, to=10)
    Globals.valueSlider.set(0)
    Globals.valueLabel.configure(text = "0")


def setUpGUI():
   Globals.window = tkinter.Tk()
   Globals.choiceVar = tkinter.IntVar()

   topFrame = tkinter.Frame(Globals.window)
   topFrame.pack()
   button1 = tkinter.Radiobutton(topFrame, text="Big range",
                                 variable=Globals.choiceVar, value=1,
                                 command=radioButtonChosen)
   button1.pack(side= tkinter.LEFT)

   button2 = tkinter.Radiobutton(topFrame, text="Small range",
                                 variable=Globals.choiceVar, value=2,
                                 command=radioButtonChosen)
   button2.pack(side= tkinter.LEFT)

   Globals.choiceVar.set(1)
   
   Globals.valueLabel = tkinter.Label(Globals.window, text="0")
   Globals.valueLabel.pack()

   Globals.valueSlider = tkinter.Scale(Globals.window, orient=tkinter.HORIZONTAL,
                                       length=100, showvalue = 0,
                                       from_=-100, to=100)
   Globals.valueSlider.pack()

   Globals.valueSlider.set(0)
   Globals.valueSlider.bind("<ButtonRelease-1>", func=sliderChanged)

def startGUI():
   setUpGUI()
   Globals.window.mainloop()



