SetStatusText of MDIParentFrame from MDIChildFrame

I

Illy

Dear my friends....

I am stucked on a problem: I can't call a function of MDIParentFrame
from MDIChildFrame: myturnonmenu and mystatusbar.SetStatusText()

Anybody would be so nice for telling me my mistakes? Please do me a favor.

Thank you very much in advance.

I created 3 files contain this sourcecode:
ceo@mefi:~/sementara/tes$ ls
jendelapos.py jendelapos.pyc myMDIChildFrameforLogin.py
myMDIChildFrameforLogin.pyc myMDIFrame.py
ceo@mefi:~/sementara/tes$
===========================================
ceo@mefi:~/sementara/tes$ cat myMDIFrame.py
#!/usr/bin/env python
import wx
import os

import jendelapos
import myMDIChildFrameforLogin

class myMDIParentFrame (wx.MDIParentFrame):
def __init__(self):
global mystatusbar, menuakuntan

wx.MDIParentFrame.__init__(self, None, -1, "This is
myMDIParentFrame", size=(1020,800))
mystatusbar = self.CreateStatusBar()
mystatusbar.SetStatusText("This is the StatusBar I want to put
my message for the users in it")
menuakuntan = wx.Menu()
menuakuntan.Append(1000, "Accounting - POS (&Point of Sale)")

menuaplikasi = wx.Menu()
menuaplikasi.Append(20000, "&Login")
menuaplikasi.Append(20001, "E&xit")

menubar = wx.MenuBar()
menubar.Append(menuakuntan, "&Accounting")
menubar.Append(menuaplikasi, "A&pplication")
myturnoffmenu(self)

self.SetMenuBar(menubar)

self.Bind (wx.EVT_MENU, self.jendelapos, id=1000)

self.Bind (wx.EVT_MENU, self.myMDIChildFrameforLogin, id=20000)
self.Bind (wx.EVT_MENU, self.OnExit, id=20001)

def OnExit(self, evt):
self.Close(True)

jendelapos = jendelapos.Show

myMDIChildFrameforLogin = myMDIChildFrameforLogin.Show

def myturnoffmenu(self):
menuakuntan.Enable(1000, False)

def myturnonmenu(self):
menuakuntan.Enable(1000, True)

if __name__ == '__main__':
app = wx.PySimpleApp()
myMDIFrame = myMDIParentFrame()
myMDIFrame.Show()
app.MainLoop()
ceo@mefi:~/sementara/tes$
=================================================
ceo@mefi:~/sementara/tes$ cat ./myMDIChildFrameforLogin.py
import wx

def Show(self, evt):
global pengguna, katakunci, jendela
jendela = wx.MDIChildFrame(self, -1, "Login Form", style=
wx.DEFAULT_FRAME_STYLE | wx.HSCROLL | wx.VSCROLL)

mystatusbar.SetStatusText("Login succeeded")
myturnonmenu()

jendela.Show(True)
ceo@mefi:~/sementara/tes$
=================================================
ceo@mefi:~/sementara/tes$ cat jendelapos.py
import wx

def Show (self, evt):
win = wx.MDIChildFrame(self, -1, "Accounting - POS")
win.Show(True)
ceo@mefi:~/sementara/tes$
=================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top