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

_________________________________________________________________
Join the Fantasy Football club and win cash prizes here!
http://fantasyfootball.malaysia.msn.com
_______________________________________________
ActivePython mailing list
ActivePython@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython

Reply via email to