Python/wxPython/QuickStart: Difference between revisions
Jump to navigation
Jump to search
| Line 19: | Line 19: | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
! Python | ! Python (main.py) || XRC (layout.xrc) | ||
|- | |- | ||
| valign="top" | | | valign="top" | | ||
Revision as of 08:51, 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>
|