> 2. Does anyone have an example somewhat resembling what I've described?
> It doesn't have to be plots, of course.
Not with a scrolledpanel, every time I use it I run into troubles
I've had pretty decent success with it for simple things like a frame with a single notebook inside a scrolled panel. That works pretty well. When I found your FoldPanelBar, I immediately thought that it would be a useful way to implement extra panels on a frame for things like ">> Advanced Options" or ">> More" buttons commonly seen.
> 3. Should I be taking a different approach altogether?
Well, I use the same approach for data analysis in my apps, but I set up things using PyAUI or wxAUI without ScrollingThings. However, if you have a sample code, it may help us a lot.
I'll post it up today. I didn't have my code in a stripped down form for uploading when I wrote the first e-mail. I'll strip it down to some sin(x) plots.
BTW Is there a trick to embedding a FPB in a panel? I couldn't get it to work at first until I copied some code from one of your demos and then it seems to work after that. Here's the bit I snagged (marked in comments). This is an early test just trying to place two plots in a FPB and then into a scrolled window. There are no extra sizers or toolbars.
class AnalysisPlotFrame(wx.Frame):
def __init__(self, title=None):
title = 'Untitled Plot Analysis'
# Initialize the Frame base class
wx.Frame.__init__(self,parent,-1,title,size=(550,350),name='plot'+str(FrameCount))
# bind the close event
self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
# Keep track of the ACTIVATE event for printing purposes
self.Bind(wx.EVT_ACTIVATE, self.OnActivate)
#this indentation is a product of bad cut & paste into Mail
panel = scrolled.ScrolledPanel(self, -1)
self.CreateFPB(panel) #uses panel as the parent
sizer = wx.BoxSizer(wx.VERTICAL)
# This was experimental and so I just grabbed the variable this way
sizer.Add(self._pnl, 1, wx.ALL | wx.GROW | wx.EXPAND)
panel.SetSizerAndFit(sizer)
panel.SetupScrolling()
# The snagged (and modified to fit here) code from FoldTestPanel although that panel
# is in reverse of what I want (a FPB in a panel)
sizer.Fit(panel)
sizer.SetSizeHints(panel)
panel.Centre()
sizer.Layout()
def CreateFPB(self, parent=None):
if not parent:
parent = self
# recreate the foldpanelbar
fpb_flags=0
self._pnl = fpb.FoldPanelBar(parent, -1, wx.DefaultPosition, wx.DefaultSize,
fpb.FPB_DEFAULT_STYLE | fpb.FPB_VERTICAL, fpb_flags)
Images = wx.ImageList(16,16)
Images.Add(GetExpandedIconBitmap())
Images.Add(GetCollapsedIconBitmap())
item = self._pnl.AddFoldPanel("Data Plot", collapsed=False,
foldIcons=Images)
# Create the main plot
# This just creates a matplotlib.figure(), puts a sin wave in it, and creates a FigureCanvasWxAgg
# using it. "item" is used as the parent for FigureCanvas()
self.canvas = self.GetDataFigureCanvas(item)
# Add it to item
self._pnl.AddFoldPanelWindow(item, self.canvas,
fpb.FPB_ALIGN_WIDTH, 0, 0)
item2 = self._pnl.AddFoldPanel("Secondary Data Plot", collapsed=True,
foldIcons=Images)
# Create the secondary plot
canvas2 = self.GetDataFigureCanvas(item2)
# Add it to item2
self._pnl.AddFoldPanelWindow(item2, canvas2,
fpb.FPB_ALIGN_WIDTH, 0, 0)
Thanks for the help,
R.
PGP.sig (186 Bytes)