Python Forum
Tkinter Shell Terminal Or Shell Output
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tkinter Shell Terminal Or Shell Output
#4
Don't use line 12 until you want to stop text from going to the file.

The way you have it set, you redirect stdout, then immediately switch it back.
the sys.stdout = hold_stdout statement shouldn't be issued until you've captured all that you want to.

Also, don't need to issuefor each command unless you need to process what's being saved.

You can change the open command to be unbuffered by using (on line 13)
sys.stdout = open(savefile, 'w', buffering=0)

Then you should be able to open the savefile is i/o mode (r+) and read what's going on.
I haven't tried this, and not sure if it will lead to file pointer problems, but so long as you're
using a single thread, all should be OK.
Reply


Messages In This Thread
RE: Tkinter Shell Terminal Or Shell Output - by Larz60+ - Dec-02-2020, 12:33 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Tkinter | entry output. Sap2ch 1 2,621 Sep-25-2021, 12:38 AM
Last Post: Yoriz
  How to show terminal output in GUI Rubberduck 2 10,998 May-29-2021, 09:01 AM
Last Post: Rubberduck
  [Tkinter] acceleration of data output in treeview tkinter Vladimir1984 4 6,175 Nov-21-2020, 03:43 PM
Last Post: Vladimir1984
  Displaying output in GUI ( Tkinter) Zouloutamtam 7 24,738 Sep-29-2020, 02:08 PM
Last Post: Zouloutamtam
  [Tkinter] Logs and terminal in Tkinter Prezess 1 4,110 Jul-26-2020, 09:49 PM
Last Post: Larz60+
  How to display results from terminal window onto tkinter. buttercup 0 4,465 Jul-21-2020, 04:41 AM
Last Post: buttercup
  How to print out the wisget structure in shell menator01 0 2,101 Apr-26-2020, 04:20 AM
Last Post: menator01
  [GTK] Virtual python shell with Vte.Pty.spawn_async() jiri 2 4,349 Oct-20-2019, 12:16 PM
Last Post: Axel_Erfurt
  Active tkinter text output during loop dvanommen 2 13,473 Oct-18-2019, 02:23 PM
Last Post: dvanommen
  sQlite3 output to tkinter treeview - how do I set / increase width of the output? dewijones67 5 8,191 Jan-23-2019, 08:45 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020