Hello,
It feels like I've found a bug. Not sure if it's in wxWindows or in
the wxPython side of things.
I was trying to do a wxGauge through a XMLResource, but what I was
getting was a wxControl that I couldn't really do anything with.
Here's some code that will reproduce the problem:
# BEGIN gauge_test.xrc
<?xml version="1.0" ?>
<resource>
<object class="wxDialog" name="DIALOG">
<title>Gauge Test</title>
<size>200,50</size>
<style>wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL</style>
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
<object class="sizeritem">
<object class="wxStaticText" name="TEXT">
<label>This is some text</label>
</object>
<border>3</border>
</object>
<object class="sizeritem">
<object class="wxGauge" name="GAUGE"/>
<flag>wxGROW</flag>
<border>3</border>
</object>
</object>
</object>
</resource>
# END gauge_test.xrc
# BEGIN gauge_test.py
from wxPython.wx import *
from wxPython.xrc import *
class MyDialog(wxDialogPtr):
def __init__(self, parent):
self.res = wxXmlResource("gauge_test.xrc")
w = self.res.LoadDialog(parent, 'DIALOG')
wxDialogPtr.__init__(self, w.this)
self.text = self.FindWindowByName('TEXT')
print self.text
self.gauge = self.FindWindowByName('GAUGE')
print self.gauge
class MyApp(wxApp):
def OnInit(self):
dlg = MyDialog(None)
dlg.ShowModal()
return 1
app = MyApp(wxPlatform == "__WXMAC__")
# END gauge_test.py
This code will output the following:
<C wxStaticText instance at _877e60_wxStaticText_p>
<C wxControl instance at _86d1a8_wxControl_p>
To do anything with self.gauge (as a gauge anyway),
I would have expected it to be a wxGauge instance.
All the other controls that I have checked seem to return
the expected instance.
Have I missed something obvious, or found a bug?
WX: 2.3.4
WXPY: 2.3.4.2
OS: WinXP Pro
Mark Peters