Re: Print redirection problem
Rolf <[email protected]> Sun, 11 Jul 2021 12:39:53 +0200
| Newsgroups | gmane.comp.python.wxpython |
|---|---|
| Message-ID | <[email protected]> |
class MyApp(wx.App):
def __init__(self, redirect=True, filename=None):
print('App __init__') # This is printed to the console
super().__init__(redirect, filename)
On 11/07/2021 07:00, Phil wrote:
> import wx
>
> class MyApp(wx.App):
> def __init__(self, redirect=True, filename=None):
> print('App __init__') # This is printed to the console
> super().__init__(self, redirect, filename)
>
> # init frame
> self.InitFrame()
>
> def InitFrame(self):
> print('Init Frame')
> frame = MyFrame(parent=None,
> title="Redirection",
> size=(300, 300),
> pos=(100, 100))
>
> frame.Show()
>
> class MyFrame(wx.Frame):
> def __init__(self, parent, title, size, pos):
> print('Frame __init__')
> super().__init__(parent=parent, title=title, size=(300, 300),
> pos=pos)
>
> self.OnInit()
>
> def OnInit(self):
> panel = MyPanel(parent=self)
>
> class MyPanel(wx.Panel):
> def __init__(self, parent):
> super().__init__(parent=parent)
>
> wx.StaticText(self, label="Redirect print to panel or file",
> pos=(20, 20))
>
> if __name__ == "__main__":
> app = MyApp(redirect=True)#, 'filename')
> app.MainLoop()
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/a458c73c-299d-9d91-0c61-5569fbbc8553%40gmail.com.