HI, guys. I want to develop a window or frame for the bash shell program. Even after trials with the code of the link given by Bryan (thank you so much!!), it still does not work.
Basically, I use the code sample put by Anurag Uniyal. However, I have to deal with several processes (so one window for one subprocess call). I do not know how to create a customeried interpretor object with my application data passed. Each time, the python compiler complain about the constructor function. Otherwise, I have to make an new interpretor class (not instance) for each application, which is not good.
MyInterpretor(mydata)#ctor error
wx.py.shell.Shell(parent=self, InterpClass=MyInterpretor)
class MyInterpretor(object):
def __init__(self, my_data, locals, rawin, stdin, stdout, stderr):
self.application=my_data
self.introText = "Welcome to " + self.application.name + "!"
self.locals = locals
self.revision = 1.0
self.rawin = rawin
self.stdin = stdin
self.stdout = stdout
self.stderr = stderr
self.more = False
origWD = os.getcwd()
os.chdir(self.application.dir)
# bash process
self.bp = Popen(self.application.cmd, shell=False, stdout=PIPE, stdin=PIPE, stderr=PIPE)
# start output grab thread
self.outputThread = BashProcessThread(self.bp.stdout.readline)
self.outputThread.start()
# start err grab thread
self.errorThread = BashProcessThread(self.bp.stderr.readline)
self.errorThread.start()
os.chdir(origWD)
actually I just want a textctrl to input/output with a background process stdin/stdout. but this wx.py.shell.Shell approach seems to heavy for me, let alone it does not work.
lyrae's code of the link looks right direction. but the code, as pointed by Bryan, cannot work with multiple times command input(Broken pipe error).