XRCでコントロールを取得する
2009/11/24
wxPython2.8.9.2
import wx
import wx.xrc
def main():
app = wx.App()
res = wx.xrc.XmlResource("control.xrc")
frame = res.LoadFrame(None,"FRAME1")
textctrl = wx.xrc.XRCCTRL(frame,"TEXTCTRL")
textctrl.SetLabel("Hello World")
frame.Show()
app.MainLoop()
if __name__ == '__main__':
main()
control.xrc
<?xml version="1.0" encoding="utf-8"?>
<resource>
<object class="wxFrame" name="FRAME1">
<title></title>
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
<object class="sizeritem">
<object class="wxPanel">
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
<object class="sizeritem">
<object class="wxTextCtrl" name="TEXTCTRL"/>
<flag>wxALIGN_CENTRE</flag>
</object>
</object>
</object>
<option>1</option>
<flag>wxALL|wxEXPAND</flag>
</object>
</object>
<size>300,200</size>
</object>
</resource>