Python global text area
global
isn't necessary when you need a variable to be shared between two methods belonging to the same class. You can just attach the variable you need to self
.
from Tkinter import*class test(Frame): def __init__(self, parent): Frame.__init__(self,parent) self.initUI() def initUI(self): mainFrame = Frame(self, parent) self.textArea = Text(maınFrame, height=10, width=10) self.textArea.pack(side=BOTTOM) self.textArea.insert(INSERT, "abc") def changeText(self): self.textArea.insert(INSERT, "def")