I'm on Python2.7 and I try to transmit a value got from a scale
, to another function which has to respond to a click.
from tkinter import *
fenetre = Tk()
def other(ev):
m=2
l=3
vol_piano=maj()
print(vol_piano)
def maj(newvalue):
vol_piano = newvalue
print(vol_piano)
return vol_piano
value = DoubleVar()
scale = Scale(fenetre, variable=value, orient ='vertical', from_ = 0, to= 100,
resolution = 1, tickinterval= 5, length=400, label='Volume Piano',command=maj)
scale.pack(side=RIGHT)
canvas = Canvas(fenetre, width=100, height=400, bg="white")
curseur1 = canvas.create_line(0, 0, 0, 0)
canvas.pack(side=LEFT)
canvas.bind("<Button-1>", other)
fenetre.mainloop()
The problem is that I can't use return because my function maj()
has in argument the new value got with scale.