Skip to content

Instantly share code, notes, and snippets.

@jarredkenny
Created January 1, 2012 15:25
Show Gist options
  • Save jarredkenny/1547594 to your computer and use it in GitHub Desktop.
Save jarredkenny/1547594 to your computer and use it in GitHub Desktop.
Creating Tabed Guis - The Wrong Way
import wx
class Gui(wx.Frame): #create a wx frame object
def __init__ (self, parent=None, *args, **kwarg): #set initial parameters
super(Gui, self).__init__(None, -1, "Example", size = (300, 250)) #pass these paramenters to my wx.Frame object,
Notebook = wx.Notebook(self) #creates a notebook which is a child of out wx.Frame
#here we create numorous panels as childs to the notebook
ChatPanel = wx.Panel(Notebook)
ForumPanel = wx.Panel(Notebook)
CoolPanel = wx.Panel(Notebook)
AnotherPanel = wx.Panel(Notebook)
#Now we add them as pages to the notebook, this is wx specific
Notebook.AddPage(ChatPanel, "Chatz")
Notebook.AddPage(ForumPanel, "Forumz")
Notebook.AddPage(CoolPanel, "Coolz")
Notebook.AddPage(AnotherPanel, "Anotherz")
if __name__ == "__main__":
#this is some wx init garbage you can ignore
App = wx.App()
Frame = Gui()
Frame.Show()
App.MainLoop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment