O'Reilly logo

Tkinter GUI Application Development Blueprints - Second Edition by Bhaskar Chaudhary

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Redirecting the command-line output to Tkinter

You may occasionally need to redirect the output of a command line to a GUI such as Tkinter. The ability to pass outputs from the command line to Tkinter opens a large pool of possibilities for using the inherent powers of the shell on Unix and Linux operating systems and the Windows shell on a Windows machine.

We will demonstrate this by using the subprocess Python module, which lets us spawn new processes, connect to the input, output, and error pipes of this new process, and obtain the return codes from the programs.

A detailed discussion on the subprocess module can be found at https://docs.python.org/3/library/subprocess.html.

We will use the Popen class from the subprocess module to create ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required