Python/wxPython/QuickStart: Difference between revisions
Jump to navigation
Jump to search
| Line 62: | Line 62: | ||
app = MyApp() | app = MyApp() | ||
app.MainLoop() | app.MainLoop() | ||
</ | </source> | ||
== wxMDIParentFrame with XRC == | == wxMDIParentFrame with XRC == | ||
Revision as of 09:02, 20 March 2019
Skeleton
wxFrame without XRC
#!/usr/bin/env python3
import wx
class MyApp(wx.App):
def OnInit(self):
frame = wx.Frame(None, -1, 'Hello World!')
frame.Show()
return True
if __name__ == '__main__':
app = MyApp()
app.MainLoop()
wxFrame with XRC
| Python (main.py) | XRC (layout.xrc) |
|---|---|
#!/usr/bin/env python3
import wx.xrc
class MyApp(wx.App):
def OnInit(self):
res = wx.xrc.XmlResource('layout.xrc')
frame = res.LoadFrame(None, 'mainFrame')
frame.Show()
return True
if __name__ == '__main__':
app = MyApp()
app.MainLoop()
|
<?xml version="1.0" encoding="utf-8"?>
<resource version="2.9.0.5">
<object name="mainFrame" class="wxFrame">
<title>Hello World!</title>
</object>
</resource>
|
wxMDIParentFrame without XRC
#!/usr/bin/env python3
import wx
class MyApp(wx.App):
def OnInit(self):
frame = wx.MDIParentFrame(None, -1, 'Hello World!')
frame.Show()
return True
if __name__ == '__main__':
app = MyApp()
app.MainLoop()
wxMDIParentFrame with XRC
| Python (main.py) | (layout.py) |
|---|---|
#!/usr/bin/env python3
import wx.xrc
class MyApp(wx.App):
def OnInit(self):
res = wx.xrc.XmlResource('layout.xrc')
frame = res.LoadObject(None, 'mainFrame', 'wxMDIParentFrame')
frame.Show()
return True
if __name__ == '__main__':
app = MyApp()
app.MainLoop()
|
<?xml version="1.0" encoding="utf-8"?>
<resource version="2.9.0.5">
<object name="mainFrame" class="wxMDIParentFrame">
<title>Hello World!</title>
</object>
</resource>
|