I have a HW assignment where I need to control volume in a tank. I need a slider scale to set the desired height of the tank. If the desired tank height is higher than the actual then it will increase and vice versa. To accomplish this I need to be able to get the value of the slider as it is changed. For this part of the assignment I wrote this code however when run and the slider position is changed the GUI crashes. Any tips on how to correct this would be appreciated. Here is the code for the slider and a label to hold the slider value.
from tkinter import * #################### root = Tk() root.title('Tank Slider') root.geometry('400x400') ###################### def StartC(): while ( 2 > 1 ): SliderVal() def SliderVal(): Svalue["text"]=Slider.get() ############################ Slider = Scale(root, from_=100, to=0, length=200,bg='#80c1ff') Slider.pack() Svalue = Label(root,text=" ") Svalue.pack() StartB = Button(root,text="Start", command=StartC) StartB.pack() ########################### root.mainloop()