开发者

How do you use multiple XRC files in the same wxpython program?

开发者 https://www.devze.com 2023-03-08 04:42 出处:网络
I am trying to make a wxpython program using multiple XRC files. I would like to load several panels from different XRC files into the same frame. I would like to keep the panels in separate XRC files

I am trying to make a wxpython program using multiple XRC files. I would like to load several panels from different XRC files into the same frame. I would like to keep the panels in separate XRC files because each of them will be a plugin for a much larger program.

开发者_JAVA百科

An example describing how to load many XRC files into the same frame would be awesome.


I know this question is very old but for completion's sake. I would initialise different panels from XRC inside a frame like so:

self.res1 = xrc.XmlResource('Panel1.xrc')
self.panel1 = self.res1.LoadPanel(self, "BtnPanel")
self.p1 = wx.Panel(self.panel1)

self.res2 = xrc.XmlResource('Panel2.xrc')
self.panel2 = self.res2.LoadPanel(self, "TxtPanel")
self.p2 = wx.Panel(self.panel2)

There are also some good tutorial for that (e.g. http://wiki.wxpython.org/XRCTutorial or http://wiki.wxpython.org/UsingXmlResources) that can be used as guidelines. Also the xrc.XmlResource documentation is useful to find the available methods.

Hopefully this is still useful. Enjoy.

0

精彩评论

暂无评论...
验证码 换一张
取 消