Implement callback

This commit is contained in:
Mykola Grymalyuk
2023-05-06 21:10:53 -06:00
parent f3e2dfc4de
commit f8b2b5a759
6 changed files with 60 additions and 22 deletions

View File

@@ -8,6 +8,16 @@ import subprocess
from resources import constants
class ThreadHandler(logging.Handler):
def __init__(self, text_box: wx.TextCtrl):
logging.Handler.__init__(self)
self.text_box = text_box
def emit(self, record):
wx.CallAfter(self.text_box.AppendText, self.format(record) + '\n')
class RedirectText(object):
"""
Redirects stdout to a wxPython TextCtrl