Improve console text control by specifying font size in pixels not points

This commit is contained in:
Marcel Stör 2019-02-17 15:05:42 +01:00
parent 29b7193fcf
commit 4500d940ae

14
Main.py
View File

@ -147,7 +147,7 @@ class FlashConfig:
class NodeMcuFlasher(wx.Frame): class NodeMcuFlasher(wx.Frame):
def __init__(self, parent, title): def __init__(self, parent, title):
wx.Frame.__init__(self, parent, -1, title, size=(700, 650), wx.Frame.__init__(self, parent, -1, title, size=(725, 650),
style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE) style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE)
self._config = FlashConfig.load(self._get_config_file_path()) self._config = FlashConfig.load(self._get_config_file_path())
@ -158,11 +158,10 @@ class NodeMcuFlasher(wx.Frame):
sys.stdout = RedirectText(self.console_ctrl) sys.stdout = RedirectText(self.console_ctrl)
self.SetMinSize((640, 480))
self.Centre(wx.BOTH) self.Centre(wx.BOTH)
self.Show(True) self.Show(True)
print("Connect your device") print("Connect your device")
print("\nIf you chose the serial port auto-select feature you might want to ") print("\nIf you chose the serial port auto-select feature you might need to ")
print("turn off Bluetooth") print("turn off Bluetooth")
def _init_ui(self): def _init_ui(self):
@ -271,10 +270,11 @@ class NodeMcuFlasher(wx.Frame):
button.Bind(wx.EVT_BUTTON, on_clicked) button.Bind(wx.EVT_BUTTON, on_clicked)
self.console_ctrl = wx.TextCtrl(panel, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL) self.console_ctrl = wx.TextCtrl(panel, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL)
self.console_ctrl.SetFont(wx.Font(13, wx.FONTFAMILY_TELETYPE, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)) self.console_ctrl.SetFont(wx.Font((0, 13), wx.FONTFAMILY_TELETYPE, wx.FONTSTYLE_NORMAL,
self.console_ctrl.SetBackgroundColour(wx.BLACK) wx.FONTWEIGHT_NORMAL))
self.console_ctrl.SetForegroundColour(wx.RED) self.console_ctrl.SetBackgroundColour(wx.WHITE)
self.console_ctrl.SetDefaultStyle(wx.TextAttr(wx.RED)) self.console_ctrl.SetForegroundColour(wx.BLUE)
self.console_ctrl.SetDefaultStyle(wx.TextAttr(wx.BLUE))
port_label = wx.StaticText(panel, label="Serial port") port_label = wx.StaticText(panel, label="Serial port")
file_label = wx.StaticText(panel, label="NodeMCU firmware") file_label = wx.StaticText(panel, label="NodeMCU firmware")