How to hold further execution of sub frame until it is closed or even is clicked?

Hi all,

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()

Jaydeep Patil wrote:

Hi all,

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?

IIUC it sounds like you may want to use a wx.Dialog instead of a wx.Frame. When the dialog is used with ShowModal then it will block access to the other top level windows in the application until the user presses Ok or Cancel on the dialog.

···

--
Robin Dunn
Software Craftsman