Greetings.
I have only take seriously to learn wxPython to make my application for DB and already totally loosing any motivation.
I am going through every step, from really really basic and toward more complex. For example: starting from subclassing wx.App.
And I stuck at setting logging facility.
To put it simply - here is the code. It works but LogWindow did not show up. What is the proper program workflow to configure logging system and how to use wx.LogWindow
?
Also, I have found in docs about wx.AppTraits
but there is not wx.App.CreateTraits
function.
# coding: utf-8
import wx
import locale
import gui01 as gui
class Application(wx.App):
wx.App.__init__(self, redirect = True)
self.main_window = None
def OnInit(self):
target = wx.LogWindow(None, u"Журнал повідомлень додатка", show = True)
target.PassMessages(False)
wx.Log.SetActiveTarget(target)
wx.LogError(u"Встановлено віконний журнал повідомлень.")
self.main_window = gui.MainWindow()
self.SetTopWindow(self.main_window)
self.main_window.Show()
wx.LogMessage(u"Створено головне вікно.")
return True
def InitLocale(self):
lang, enc = locale.getdefaultlocale()
self._initial_locale = wx.Locale(lang, lang[:2], lang)
locale.setlocale(locale.LC_ALL, lang.replace("_", "-"))
if __name__ == "__main__":
Application().MainLoop()
Windows 7
Python 3.8
wxPython 4.1.1