Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #16048 > unrolled thread

SetStatusText of MDIParentFrame from MDIChildFrame

Started byIlly <illy@otekno.biz>
First post2011-11-22 02:21 +0700
Last post2011-11-22 02:21 +0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  SetStatusText of MDIParentFrame from MDIChildFrame Illy <illy@otekno.biz> - 2011-11-22 02:21 +0700

#16048 — SetStatusText of MDIParentFrame from MDIChildFrame

FromIlly <illy@otekno.biz>
Date2011-11-22 02:21 +0700
SubjectSetStatusText of MDIParentFrame from MDIChildFrame
Message-ID<mailman.2932.1321905761.27778.python-list@python.org>
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$
=================================================

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web