hi all,
i use MVC pattern in which run.py have bind method.
it is great , it helps to organize my project, but when doing this, child frame spawns when i launch my prog. And when i close the child window, if i want it again from main frame, it’s not reactive anymore if i click “ok”.
here is my files:
run.py (controller and starter)
import wx
from top import Top
from v_WC import v_WC
class Controller:
def init(self, app):
self.ct_top = Top(None)
self.ct_top.button_viewWC.Bind(wx.EVT_BUTTON, self.ct_top.Onbutton_viewWCButton, id=-1)
self.ct_v_WC = v_WC(parent = self.ct_top)
self.ct_v_WC.btn_ok.Bind(wx.EVT_BUTTON, self.ct_v_WC.OnClose)
app = wx.App(False)
controller = Controller(app)
controller.ct_top.Show()
app.MainLoop()
``
here my main frame (top.py)
import wx
import wx.lib.dialogs
import v_WC
class Top(wx.Frame):
def init(self, parent):
wx.Frame.init(self, id=-1, parent=parent, size=wx.Size(800, 600), title=‘Top’)
self.panel1 = wx.Panel(self, id=-1)
self.button_viewWC = wx.Button(self.panel1, id=-1, label='viewWC', pos=wx.Point(96, 200), size=wx.Size(187, 28), style=0)
def Onbutton_viewWCButton(self, event):
self.v_WC = v_WC.create(self)
self.v_WC.Show()
event.Skip()
``
here is my child frame (v_WC.py)
import wx
def create(parent):
return v_WC(parent)
class v_WC(wx.Frame):
def init(self, parent):
wx.Frame.__init__(self, id=-1, parent=parent, title='v_WC', size=(700, 550))
self.panel1 = wx.Panel(self, id=-1, size=wx.Size(700, 550))
self.btn_ok = wx.Button(self.panel1, label="Ok ", pos=(20, 400), size=(60, -1))
self.Centre()
self.Show(True)
def OnClose(self, e):
self.Close(True)
``
···
–
You received this message because you are subscribed to the Google Groups “wxPython-users” group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/0e1fec97-a09f-421d-8ccd-8a2762050884%40googlegroups.com.