Dear friends,
is there a way to execute a dos command in a frame inside a wx.window GUI (and not in the usual external window)?

Recommended Answers

All 5 Replies

No, I think. You must execute the command by yourself. wx is only for window management.

I see, so just to clarify, there is no way to "capture" the dos output in a window, isn't it?
What I would like to do is similar to what happens in linux when you want to install one package with synaptic and you click to show the details during the installation (sorry but I don't know how else to explain what I need to do).
If this is not possible, thanks anyway for your help,

Take a look at:

Should have enough hints how to do this with wxPython.

Basically ...

# using module subprocess to get the
# directory of drive C:\
# Python27 code

import subprocess

p = subprocess.Popen("dir C:\\", shell=True, stdout=subprocess.PIPE)

# allow external program to work

# read the result to a string
# (Python3 gives bytearray rather than string)
result =


The wxWin tool set is a GUI library, but you can run any C or C++ code inside your wx functions. There are C functions which will run an external program and have the ability to pipe (as shown in the python example posted by vegaseat) the output to the calling process. You capture that output and stick it in an appropriate GUI widget.

Note that wxPython is the Python wrapper for the C/C++ based wxWindows.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.