ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> activepython
activepython
AuiMDIParent method issue
by Devendran Chandra other posts by this author
Apr 28 2009 10:47AM messages near this date
view in the new Beta List Site
ANN: ActivePython 2.6.2.2, 3.1.0b1.0, 2.5.4.4 is now available | Re: AuiMDIParent method issue
Hi,

i am developing a simple automation program at my place, and decided to use wxpyhton to do i
t. 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 t
o be able to highlight and choose the right child frames at random. Attached is a working co
de. 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
Thread:
Devendran Chandra
Sridhar Ratnakumar

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved