XRC and dynamically created widgets?
John Salerno
johnjsal at NOSPAMgmail.com
Tue Oct 3 12:08:06 PDT 2006
Robin Dunn wrote:
> John Salerno wrote:
>> John Salerno wrote:
>>> Robin Dunn wrote:
>>>
>>> >> I'm not really sure how to create the Notebook at a later time,
>>> >> because it only needs to be done once,
>>> >
>>> > See the attached for one way to do it.
>>>
>>> Thanks! It's making more sense now!
>>
>> Hmm, I just noticed that this still does the same thing. =
> =
> Yeah, I know the color problem wasn't solved, I was just showing you a =
> way to create the notebook later when you create the first page.
> =
Ah yeah, that part made sense. :)
But here's another thing. I think I might just give up on this if I =
can't get these details right. I'm attaching my two files. It looks good =
when it first starts, but as soon as a tab is added, the fun begins.
1. The background is white, so you can't see the text controls.
2. Expanding the window reveals a dark gray background that never goes =
away. This time the tabs stay white!
3. Opening a second tab doesn't show the text controls until you click =
on a different tab then click back.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbgui.xrc
Type: text/xml
Size: 3362 bytes
Desc: not available
Url : http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/20061=
003/64465385/dbgui.bin
-------------- next part --------------
import wx
from wx import xrc
class DBApp(wx.App):
def OnInit(self):
self.res =3D xrc.XmlResource('dbgui.xrc')
self.InitFrame()
return True
def InitFrame(self):
self.frame =3D self.res.LoadFrame(None, 'mainFrame')
self.panel =3D xrc.XRCCTRL(self.frame, 'panel')
self.notebook =3D xrc.XRCCTRL(self.panel, 'notebook')
self.frame.Bind(wx.EVT_MENU, self.OnNewRecord, id=3Dxrc.XRCID('newRecordM=
enuItem'))
self.frame.Show()
def OnNewRecord(self, evt):
self.page =3D self.res.LoadPanel(self.frame, 'dataPage')
self.notebook.AddPage(self.page, '')
if __name__ =3D=3D '__main__':
app =3D DBApp(False)
app.MainLoop()
More information about the wxpython-users
mailing list