Created
March 11, 2011 17:07
-
-
Save MarkNenadov/866208 to your computer and use it in GitHub Desktop.
A Demonstration of how to use a wxPython "Notebook" with panels (WARNING: old code)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A demonstration of how to use a wxPython "Notebook" with panels | |
# | |
# Warning #1: This is a demonstration of how to do a particular thing in wxPython, it is not fully functioning code, | |
# you need to quite literally "fill in the dots" | |
# | |
# Warning #2: This is very old code. I can't guarantee it will work with newer version of Python or wxPython, | |
# this is 9 year old code! | |
# | |
# Note: This example assumes that you have files named panel1.py, panel2.py, panel3.py which contain a "runPanel" | |
# function which basically returns a wxPanel object. | |
# | |
# - Mark Nenadov | |
from wxPython.wx import * | |
class MainFrame(wxFrame): | |
. | |
. | |
. | |
def __init__(self, parent, id, title): | |
. | |
. | |
. | |
# Create the Notebook | |
self.nb = wxNotebook(self, -1, wxPoint(0,0), wxSize(0,0), wxNB_FIXEDWIDTH) | |
# Make PANEL_1 (filename: panel1.py) | |
self.module = __import__("panel1", globals()) | |
self.window = self.module.runPanel(self, self.nb) | |
if self.window: | |
self.nb.AddPage(self.window, "PANEL_1") | |
# Make PANEL_2 (filename: panel2.py) | |
self.module = __import__("panel2", globals()) | |
self.window = self.module.runPanel(self, self.nb) | |
if self.window: | |
self.nb.AddPage(self.window, "PANEL_2") | |
# Make PANEL_3 (filename: panel3.py) | |
self.module = __import__("panel3", globals()) | |
self.window = self.module.runPanel(self, self.nb) | |
if self.window: | |
self.nb.AddPage(self.window, "PANEL_3") | |
. | |
. | |
. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment