Hold wxframe (GUI)

Jaydeep Patil patil.jay2009 at gmail.com
Wed Mar 26 06:04:26 CET 2014


I constructed Two frames.
One frame consist of GUI which consist of one Ok button.

Afer click on OK button another GUI calls. But after Second gui calling, It wont stop further procesees. I need to stop futher proceeses. How can i hold second gui?


Please reply



Sample Code is:

import wx
class App(wx.App):
    '''
    classdocs
    '''
    def __init__(self,name=None):
        '''
        Constructor
        '''
        wx.App.__init__(self)
        self.d = Dashboard()
        self.d.Show()
        
    def _startMainLoop(self):
        self.MainLoop()
        pass
    
    def start(self):
        #self.d.Show()
        self._startMainLoop()
        pass


class Dashboard(wx.Frame):
    '''
    classdocs
    '''
    def __init__(self,name=None):
        '''
        Constructor
        '''
        wx.Frame.__init__(self,None,wx.ID_ANY)
        print("Frame 1")
        
        self.btnOk = wx.Button(self,-1,"OK")
        
        self.btnOk.Bind(wx.EVT_BUTTON,self.test)
    
    def test(self,event):
        print("Before")
        self.f = Dashboard1(self)  ##  I need to Stop here only
        self.f.Show()
        self.f.MakeModal(True)
        print("AFter")

        
        
class Dashboard1(wx.Frame):
    '''
    classdocs
    '''
    def __init__(self,parent):
        '''
        Constructor
        '''
        wx.Frame.__init__(self,parent,wx.ID_ANY)
        
a = App()
a.start()


Output is :
Frame 1
Before
After



More information about the Python-list mailing list