Apr-24-2021, 04:39 AM
(This post was last modified: Apr-24-2021, 08:11 AM by Yoriz.
Edit Reason: Added code tags
)
I have written the below code for displaying some content on the 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?
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__":