Can somebody tell me why this will not print the value? I want to print the output of the Scale
widget every time it changes.
from tkinter import *
master= Tk()
master.geometry('500x500+0+0')
def print_value(val):
print val
c1 = Scale(master, from_=255, to=0, length =400,width =100, troughcolor = 'blue',command=print_value)
c1.grid(row=1,column=2)
root.mainloop()
If you're using
Python 3
then you should changeprint val
toprint(val)
as in Python3print
is a function, not an operator.Also you should probably replace
root
withmaster
on the last line as there is noroot
variable in your code.