Hi,
I am pretty new to python and wxPython but am loving it!
I have spent the last few days mastering all of the basics of each and
every widget. They all make plenty of sense when creating it in
isolation. However I am still having issues getting them to work well
together.
As I have been learning wxPython I have been trying to create a tiered
widget setup that has proven particularly difficult.
a NOTEBOOK, containing a>
PANEL, that scrollable via a>
SCROLLING WINDOW, which just above the bottom scroll bar
has a>
SLIDER, then above the slider have a few...
PLATE BUTTONS...
The program below does not included the Scrolling Window, Slider, nor
the Plate Buttons, as I cannot for the life of me figure out how to
get them created as children of the Panel.
Hopefully what I am describing is clear enough, but I am curious as to
whether it is possible to create this type of tiered setup?
Also I do not know how at attach pictures or .py files to these
discussions, if anyone could assist in that also it would be greatly
appreciated.
Cheers,
-Cort
Here is my current setup.
Windows XP 32bit.
Python 2.6
wxPython 2.8
### -- START OF EXAMPLE PROGRAM --
import wx
import wx.aui
import wx.lib.scrolledpanel as scroll
#Defining File Menu Options
ID_OPEN = 101
class NBPanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent)
t = wx.StaticText(self, -1, "1. The Notebook is currently the
parent of this Panel."
"\n2. I am try to create a Scrolling Window
that occupys the entire contents of the parent Panel."
"\n3. Inside the Scrolling Window I want a
Slider at the bottom of the Panel just above the Scrolling Bar."
"\n4. Inside the Panel above the Slider I
want to put a few Plate Buttons.\n"
"\n Notebook>"
"\n Panel>"
"\n Scrolling Window>"
"\n Slider..."
"\n Plate Buttons...",
(5,25))
class RootFrame(wx.Frame):
def __init__(self, parent, id = -1, title = "Audio Interpreter",
pos = wx.DefaultPosition, size = (800, 400),
style = wx.DEFAULT_FRAME_STYLE):
# -- Init for RootFrame --
wx.Frame.__init__(self, parent, id, title, pos, size, style)
# -- Enabling the AUI Manager --
self._mgr = wx.aui.AuiManager(self)
# -- Adding StatusBar --
self.CreateStatusBar() # - Status Bar
# -- Adding MenuBar --
filemenu = wx.Menu()
filemenu.Append(ID_OPEN, "&Open...", "Opens a Saved TTY File")
menubar = wx.MenuBar()
menubar.Append(filemenu, "&File")
self.SetMenuBar(menubar)
# -- Creating Notebook and its child Panel --
nb = wx.Notebook(self)
ttytab = NBPanel(nb)
# -- Adding a single page to the Notebook
nb.AddPage(ttytab, "Mon Aug 31 15-24-23 2009")
# -- Creating a Scroll Window for the Far Left Section --
eventpanel = scroll.ScrolledPanel(self, -1, size =(120, 275),
style = wx.TAB_TRAVERSAL, name ="Event Panel" )
eventpanelpanelsizer = wx.FlexGridSizer(cols = 2, vgap = 4,
hgap = 4)
eventpanel.SetSizer(eventpanelpanelsizer)
eventpanel.SetAutoLayout(1)
eventpanel.SetupScrolling()
# --
# -- Sizer for the Root Frame --
sizer = wx.BoxSizer(wx.HORIZONTAL)
sizer.Add(eventpanel, 1, wx.EXPAND)
sizer.Add(nb, 4.5, wx.EXPAND)
self.SetSizerAndFit(sizer)
self._mgr.Update()
self.Show(True)
app = wx.App()
frame = RootFrame(None)
app.MainLoop()
del app
### -- END OF EXAMPLE PROGRAM --