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
ATT00000 (259 Bytes)
···
**
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
What can you do with the new Windows Live? Find out
See all the ways you can stay connected to friends and family