I have a text area created in initUI(self) function and would like to add to its contents in another one. When I initialize the text area as global on top of the class, the area is created in an another window, which is not what I want. I have seen questions related to the global variables but not something like this.
from Tkinter import*
textArea = Text() # creates another window
class test(Frame):
def __init__(self, parent):
Frame.__init__(self,parent)
self.initUI()
def initUI(self):
mainFrame = Frame(self, parent)
textArea = Text(maınFrame, height=10, width=10)
textArea.pack(side=BOTTOM)
textArea.insert(INSERT, "abc")
def changeText():
global textArea
textArea.insert(INSERT, "def")
thanks