Executing system commands with wxpython

Tom B. sbabbitt at commspeed.net
Fri Sep 10 20:12:00 CEST 2004

"twsnnva" <twsnnva at msn.com> wrote in message 
news:3dec2e051d82da31c9fe868669e3ce6d at localhost.talkaboutprogramming.com...
> Could anyone give me an example (code) of a simple program with a button
> that when clicked executes a linux shell or windows dos command like
> "ifconfig" or "ipconfig" and prints the output somewhere in the same
> window. Thanks.
First ,

import popen2

In your 'OnButtonEvent' function,

tomin, tomout = popen2.popen4( 'ipconfig')
ipconfig_text = tomin.read()

then you can put the results into your window of choice.

P.S. Try it out by using the new modifiable demo.

More information about the Python-list mailing list