I have two Python files, test51.py and test61.py
The first file has a widget with a button and text box The second file has a couple of functions to insert text to the textbox.
When I run, I am getting "T" is not defined - T is the textbox's name.
How may I make the text box visible in the second file?
First file; test51.py
#!/usr/bin/python3
from tkinter import *
from test61 import *
def main():
root = Tk()
T = Text(root, height=2, width=30)
T.pack()
T.insert("1.0", "Just a text Widget\nin two lines\n")
MyButton = Button(root, text = 'Press Me', command = lambda: test())
MyButton.pack()
root.mainloop()
if __name__ == "__main__":
main()
Second file; test61.py
#!/usr/bin/python3
from tkinter import *
from test51 import *
import time
def test():
delay = 3.0
time.sleep(delay)
print_to_gui('Files currently transferring')
time.sleep(delay)
print_to_gui('Currently merging all pdfs')
def print_to_gui(quote):
T.insert("1.0", quote)