I have written the below code for displaying some content on GUI window. Some of the code I have removed from between which was not needed here. _print(text) function is used to print the content on the gui screen. Can someone tell me how I can make this function globally accessible so that _print statements in other functions of the same class also get updated on the GUI.
I cannot move this _print function outside of GUI() function.
Basically i need all my print statements to be pushed on tkinter. How do I do that?
def accept_client_connections(master=None):
try:
while True:
# some code
_print("This statement needs to be printed on tkinter")
def GUI():
***def _print(text):
tex.insert(END, text + '\n')
tex.see("end")***
window = Tk()
#some code
tex = Text(window,width=80, height=40, font=('arial',10,'bold'), wrap=WORD)
tex.pack(side=TOP, fill=X,padx=10,pady=5)
messagebox.showinfo("","Waiting")
_print('xvdgfd...')
if __name__ == "__main__":