Skip to content Skip to sidebar Skip to footer

Build Cmd Into Tkinter Window

Hi i was wondering if you could have the comand prompt box pop into the Tkinter window when you start the program? Some thing like: from Tkinter import * admin = Tk() cmd = Cmd(adm

Solution 1:

http://tkinter.unpythonic.net/wiki/CmdTkHere is what you want, this is not just opening a cmd window. its embedding cmd.exe into a Tkinter.Frame. And a note here if you rename the python script to ".pyw" extension, the console will be hidden. Except for in a virtual environment's.

Solution 2:

I don't believe there is any built in console widget. It may be possible to whip up a custom one using the Tkinter Text widget. However, that would take a bit of effort/time.

Another possible option is simply have your program launch command prompt.

Two different ways to launch command prompt on a Windows machine.

import subprocess, os

subprocess.Popen('cmd.exe')

os.system("cmd.exe") 

EDIT:

Unforunetly I don't believe there is any built in widget like that. However I thought of another possible solution, check out the code for the IDLE GUI, it has a console and the GUI portion is entirley written using Tkinter. So you may be able to utelize that code.

Post a Comment for "Build Cmd Into Tkinter Window"