Hi all. I'm having a bit of trouble implementing the basics of a multi panel GUI. Basically I need a GUI that will act as an in-dash display for a car. The home screen will offer the user the ability to chose a selection of buttons. For example, the 'settings' button should lead to a new screen where the user can change settings, etc.

What would be the best way to implement this? I was think about using a notebook, but I would need to hide the tabs, not sure how to do this. Then I thought about using panels and clicking a button will launch a new panel, etc. Here's the code that I was working on for the multi panel approach (doesn't work by the way, anyone know how I can solve the error "AttributeError: 'NoneType' object has no attribute 'loadNewPanel'"?):

import wx

class PanelOne(wx.Panel):
        def __init__(self, parent):
                wx.Panel.__init__(self, parent, -1)

                self.parent = parent.GetParent()

                wx.StaticText(self, -1, "PANEL 1", (10,10))
                self.switch=wx.Button(self, label="SWITCH", pos=(5,40), size=(60,30))
                self.Bind(wx.EVT_BUTTON, self.OnButton, self.switch)

        def OnButton(self, event):
                self.parent.loadNewPanel(self)

class PanelTwo(wx.Panel):
        def __init__(self, parent):
                wx.Panel.__init__(self, parent, -1)

                wx.StaticText(self, -1, "PANEL 2", (10,10))
                self.switch=wx.Button(self, label="SWITCH", pos=(5,40), size=(60,30))
                self.Bind(wx.EVT_BUTTON, self.OnButton, self.switch)

        def OnButton(self, event):
                self.parent.loadNewPanel(self)

class myframe(wx.Frame):
        def __init__(self, parent, id):
                wx.Frame.__init__(self, parent, id, 'Frame', size=(600,320))
                panel=PanelOne(self)

        def loadNewPanel(self, invoker):
                if isinstance(invoker, PanelOne):
                        self.panel = PanelTwo(self)
                else:
                        self.panel = PanelOne(self)

# Main handling
if __name__=='__main__':
        app=wx.PySimpleApp()
        frame=myframe(parent=None,id=-1)
        frame.Show()
        app.MainLoop()

Any help would be much appreciated. Thanks in advance.

Figured it out!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.