I got a problem using variables from one function onto another.
This is my code:
import tkinter as tk
def form ():
textVar = tk.StringVar()
entry0 = tk.Entry(self, textvariable = textVar).pack()
def toPrint():
texto = textVar.get()
print(texto)
def button():
button0 = tk.Button(text="Summit", command = toPrint).pack()
Now the variable being called in toPrint() is local from form(), therefore I can not use it without using global, but that is causing issues with the rest of my code since I'm using form() more than once, is there any other way to solve it?
I would appreciate if the explanation is simple, I'm still a beginner.
I already have searched for this in SO, but I did not manage to understand the answers.