Hi.
Imagine that we have 1.py and 2.py as a main window and a sub window, and we want to create a button to navigate between them.
For an explanation of the idea see the code:
1.py (the main window):
import wx
class app(wx.Frame):
def __init__(self, parent):
super(app,self).__init__(parent,-1, title= 'example app')
p = wx.Panel(self,-1)
self.Center()
self.btn = wx.Button(p,-1, 'go')
self.btn.Bind(wx.EVT_BUTTON, self.onBtn)
self.Show()
def onBtn(self, event):
# I need the code to import the 2.py's class.
app = wx.App()
app(None)
app.MainLoop()
2.py (the sub window):
import wx
class appTwo(wx.Frame):
def __init__(self, parent):
super(appTwo,self).__init__(parent,-1, title= 'example app')
p = wx.Panel(self,-1)
self.Center()
self.btn = wx.Button(p,-1, 'back')
self.btn.Bind(wx.EVT_BUTTON, self.onBtn)
self.Show()
def onBtn(self, event):
# I need the code to import the 1.py's class.
app = wx.App()
app2(None)
app.MainLoop()
so, what’s the code shuld we put in the onBtn def?