Reputation: 909
Is there a way I can embed the console window in to a wxPython form?
When I run my code, both the python console and wxPython Form open, but I would like to see the information on the App window somehow
Upvotes: 4
Views: 1833
Reputation: 909
I found a way to redirect after some searching
class RedirectText(object):
def __init__(self,aWxTextCtrl):
self.out = aWxTextCtrl
def write(self,string):
self.out.WriteText(string)
Then I just setup a TextCtrl from wxPython to redirect the output to
self.log = wx.TextCtrl(main_panel, -1, size=(200, 100), style=wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL)
redir = RedirectText(self.log)
sys.stdout = redir
Upvotes: 4