(Main.py)
from tkinter import *
from second import numbers
a1=0
LABEL = tk.Label(text=f"Your value is:{a}", font=("Arial", 24, "bold"))
LABEL.grid(column=19, row=6)
(second.py)
class numbers
def function(self):
root=Toplevel()
my_canvas=tk.Canvas(500,500).pack()
def function1():
e= min. + max.
a=e
return a #if I do this I cannot see my canvas,if I use return inside function1 nothing happens
#I can use a to change label as such;
global LABEL
LABEL = tk.Label(text=f"Your value is:{a}", font=("Arial", 24, "bold"))
LABEL.grid(column=19, row=6)
Even though I can change the "LABEL" using global
,I cannot change "a1" variable with "a" at the same time in tkinter.
When I try this solution:
Python nested functions variable scoping
solution is using return
function, if I do this I cannot display my canvas
My purpose is using "a" 's value and changing "a1"