Hi Devendran, You may also try asking on the wxpython-users mailing list where there is a greater chance of getting a response:
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users On 09-04-28 10:47 AM, Devendran Chandra wrote: > Hi, > > i am developing a simple automation program at my place, and decided to > use wxpyhton to do it. I have a minor setback, which i hope some learned > user could help me out with > > I am unsure why the method self.SetActiveChild(pChildFrame) below > doesn't work. My idea is to be able to highlight and choose the right > child frames at random. Attached is a working code. Is there anything i > am missing? > > Thank you for your valuable response > * > import wx > import wx.aui > > #---------------------------------------------------------------------- > > class ParentFrame(wx.aui.AuiMDIParentFrame): > def __init__(self, parent): > wx.aui.AuiMDIParentFrame.__init__(self, parent, -1, > title="Oven Management System", > size=(640,480), > style=wx.DEFAULT_FRAME_STYLE) > self.count = 0 > mb = wx.MenuBar() > self.mb=mb > file_menu = wx.Menu() > new_item = file_menu.Append(-1, "Create new child window") > self.Bind(wx.EVT_MENU, self.create, new_item) > new_item1 = file_menu.Append(-1, "Choose child window") > self.Bind(wx.EVT_MENU, self.choose, new_item1) > new_item2 = file_menu.Append(-1, "Close parent") > self.Bind(wx.EVT_MENU, self.OnDoClose, new_item2) > mb.Append(file_menu, "File") > self.SetMenuBar(mb) > self.CreateStatusBar() > self.SetMenuBar(mb) > self.child=[] > > def create(self, evt): > for i in range(5): > self.child.append(ChildFrame(self, i,self.mb)) > > def choose(self,evt): > self.SetActiveChild(self.child[2]) > > def OnDoClose(self, evt): > self.Close() > #-------------------------------------------------------------------------------------------------------------------- > > class ChildFrame(wx.aui.AuiMDIChildFrame): > def __init__(self,parent,count,mb): > wx.aui.AuiMDIChildFrame.__init__(self, parent, -1, > title="BIST: %d" % count) > menu = wx.Menu() > item = menu.Append(-1, "This is BIST %d's menu" % count) > > #------------------------------------------------------------------------------------------------------------ > > class MainApp(wx.App): > def OnInit(self): > self.frame =ParentFrame(None) > self.frame.Show(True) > return True > > if __name__ == '__main__': > app = MainApp(0) > app.MainLoop() > > *Rgds, > Devendran > Sr.Product Engineer > SSD Division > > ------------------------------------------------------------------------ > Chat online and in real-time with friends and family! Windows Live > Messenger <http://get.live.com/messenger/overview> > > > ------------------------------------------------------------------------ > > _______________________________________________ > ActivePython mailing list > ActivePython@listserv.ActiveState.com > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython > _______________________________________________ ActivePython mailing list ActivePython@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython