Re: [wxpython-users] Re: wx.Panel doubts...
by Mark Erbaugh other posts by this author
May 9 2008 6:48AM messages near this date
[wxpython-users] Re: wx.Panel doubts...
|
Re: [wxpython-users] Re: wx.Panel doubts...
On Fri, 2008-05-09 at 09:29 -0300, David Anderson wrote:
> 1: How to put a Sizer exactly in the Middle of the panel? Even
> if the screen is resized?
Here's what I do to center a button across the bottom of a dialog
sizer = wx.BoxSizer(wx.HORIZONTAL)
sizer.Add((1,1), 1)
btn = wx.Button(pnl,id=wx.ID_PRINT)
sizer.Add(btn, 0, wx.EXPAND)
sizer.Add((1,1), 1)
With this layout, the widget (button) stays the same size if the panel
is resized, the space is adjusted evenly on either side.
To center vertically, you could use a similar technique with a vertical
BoxSizer and add sizer from above to the center slot
> 4: How to change panels in the same frame?
> For example: I'm on Panel A, then I clik on the menu which
> changes to Panel B, Also in each panel would have a
> Forward/Backward button, that will go to the previous Panel,
> or the post Panel, Just as Web Browsers forward/backward
What I would do is make Panels A and B children of another panel. I
would then hide all but the panel of interest and show that. Here's some
code. self.data_window is the parent panel. The panel parameter is the
panel I want displayed.
def replace_panel(self, panel):
self.data_window.Freeze()
try:
for i in self.data_window.GetChildren():
i.Hide()
panel.Show()
panel.Fit()
self.data_window.Layout()
finally:
self.data_window.Thaw()
Mark
_______________________________________________
wxpython-users mailing list
wxpython-users@[...].org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
Thread:
David Anderson
David Anderson
Mark Erbaugh
Kalle Haglunds
python
David Anderson
Mike Driscoll
Jorgen Bodde
David Anderson
Robin Dunn
David Anderson
Robin Dunn
C M
|