Hello all!
I am pretty new to python and wxpython. I have some issues and looking for some pointers. What I am trying to do is have a single frame app, that we use panels and buttons to navigate through. I am unsure of the proper way to access (hide/show) the panels, and that is where I am stuck. I have it somewhat working using the Panel Switching Tutorial but I was trying to stay away from menus and sizers if possible since the layout will be pretty specific at the moment.
The flow would just be this:
MainFrame will create the panels and initially hide most of them (or should they be created when needed?), showing only the Start panel.
The Start panel will eventually have multiple buttons that lead to other panels that will do something.
Thanks!
So a little snippet, and my problem being what I should put in the OnClick method to get to the other panel:
class Start(wx.Panel):
#Will change to using a background and bitmap buttons
def init(self, parent):
wx.Panel.init(self, parent=parent, size=(500,500))
if DEBUG:
print “In Start init”
testBtn = wx.Button(self,label=“Start Button”)
self.Bind(wx.EVT_BUTTON, self.OnClick, testBtn)
#self.Bind(wx.EVT_BUTTON, self.GoBack)
def OnClick(self, event):
if DEBUG:
print "Start Button Clicked"
#Want to show panel_one now in the frame.
self.Hide()
#self.panel_one.Show()
#panel_one.Show()
class MainFrame(wx.Frame):
def init(self):
wx.Frame.init(self, None, wx.ID_ANY,
“Button Panel Switches”, size=(500,500))
#maybe make a panel here instead with the buttons and hide/show the panels
self.start = Start(self)
self.panel_one = PanelOne(self)
self.panel_one.Hide()
panel_test.py (1.73 KB)