Feb-21-2021, 10:05 PM
Hello guys.I have a question about a tutorial I saw and I don't understand something.
So, I have the following code that has 2 sliders.
I don't use them inside functions.
So, what's the point of passing arguments in these 2 functions.
It's weird.
Thanks a lot!!
So, I have the following code that has 2 sliders.
from tkinter import *
root = Tk()
root.geometry("800x700")
def vertical_num(var):
my_label = Label(root , text = vertical_slider.get() )
my_label.place(x=650,y=100)
def horizontal_num(var):
my_label = Label(root , text = horizontal_slider.get() )
my_label.place(x=100,y=100)
vertical_slider = Scale(root , from_ = 0 , to = 400 , command = vertical_num)
vertical_slider.pack()
horizontal_slider = Scale(root , from_ = 0 , to = 400 , orient = HORIZONTAL , command = horizontal_num)
horizontal_slider.pack()
root.mainloop()I want to get the values of sliders in real time (when I change the position of sliders of course) and I don't understand the point of passing an argument in these two functions I have.Without these arguments, I receive errors.I don't use them inside functions.
So, what's the point of passing arguments in these 2 functions.
It's weird.
Thanks a lot!!
