Sizers inside NoteBook pages

Hi all,

I have a problem getting the controls on panels on my NoteBook pages to re-size when I re-size the Frame.

The MainFrame has a SplitterWindow

I create two panels for the SplitterWindow. leftPanel and rightPanel. They both have BoxSizers.

leftPanel has a TreeListControl and rightPanel has a NoteBook.

Then I add a panel to each page of the NoteBook.
Inside the Panels I have some staticText controls and on one I have three StaticBoxes with some controls in them.

How do I get the panels in the NoteBook to be able to scroll up and down if the Frame is smaller than the height of the panels in the pages?
I know I am missing some sizers somewhere, but I don’t where I should use the sizers. Do I need to use some StaticBoxSizers as well or Flexgridsizers in the Panels?

Here are snippets from my code:

class MyMenu(wx.Frame):

def _init_notebook_pages(self, parent):
    # initialize the notrbook pages in the right pane       
    parent.AddPage(imageId=-1, page=self.panel_ne_id, select=True,
          text="Page 1")
   
    parent.AddPage(imageId=-1, page=self.panel_location_info, select=False,
          text="Page 2")   

def _init_right_panel(self):
   
    rightPanel = wx.Panel(self.splitter, size=wx.Size(711, 345))
   
    # Create the right box sizer that will contain the panel's contents
    rightBox = wx.BoxSizer(wx.VERTICAL)

    # Create a widget to display static text and store it in the right panel
    self.notebook = wx.Notebook(id=wxID_MAINFRAMENOTEBOOK, parent=rightPanel)

    # Notebook pages
    # Yes, this one is in a different module that gets imported at the beginning
    self.panel_ne_id = IdPanel.PanelNeId(id=wxID_NOTEBOOKPANELNEID,
          name='Page_1', parent=self.notebook, pos=wx.Point(0, 0),
          size=wx.Size(711, 345), style=wx.TAB_TRAVERSAL)

    self.panel_location_info = wx.Panel(id=wxID_NOTEBOOKPANELLOCATIONINFO,
          name='loc_info', parent=self.notebook, pos=wx.Point(0, 0),
          size=wx.Size(711, 345), style=wx.TAB_TRAVERSAL)

def _init_ctrls(self, parent):
   
    wx.Frame.__init__(self, id=-1, name=u'DataFrame',
          parent=parent, pos=wx.Point(559, 17), size=wx.Size(1321, 1033),
          style=wx.DEFAULT_FRAME_STYLE, title=u'my Frame')
   
    self.splitter = wx.SplitterWindow(self)
   
    # Create the left panel
    leftPanel = self._init_left_panel()
   
    # Create the right panel
    rightPanel = self._init_right_panel()

    # Put the left and right panes into the split window
    self.splitter.SplitVertically(leftPanel, rightPanel, 300)

def __init__(self, parent):
  
   self._init_ctrls(parent)
···

Try using a wx.ScrolledWindow or a wx.lib.scroledpanel instead of the panels.

···

On 7/8/12 10:00 PM, kma_jg wrote:

Hi all,

I have a problem getting the controls on panels on my NoteBook pages to
re-size when I re-size the Frame.

The MainFrame has a SplitterWindow

I create two panels for the SplitterWindow. leftPanel and rightPanel.
They both have BoxSizers.

leftPanel has a TreeListControl and rightPanel has a NoteBook.

Then I add a panel to each page of the NoteBook.
Inside the Panels I have some staticText controls and on one I have
three StaticBoxes with some controls in them.

How do I get the panels in the NoteBook to be able to scroll up and down
if the Frame is smaller than the height of the panels in the pages?
I know I am missing some sizers somewhere, but I don't where I should
use the sizers. Do I need to use some StaticBoxSizers as well or
Flexgridsizers in the Panels?

--
Robin Dunn
Software Craftsman

Hi,

I have no idea on how to implement this and can’t find any good examples of it.
Looking at the code I posted, the leftpanel is the one with my notebook in. Do I change that to a scrolledpanel or the panels inside my notebook pages?

Thanks

···

On Mon, Jul 9, 2012 at 3:49 PM, Robin Dunn robin@alldunn.com wrote:

On 7/8/12 10:00 PM, kma_jg wrote:

Hi all,

I have a problem getting the controls on panels on my NoteBook pages to

re-size when I re-size the Frame.

The MainFrame has a SplitterWindow

I create two panels for the SplitterWindow. leftPanel and rightPanel.

They both have BoxSizers.

leftPanel has a TreeListControl and rightPanel has a NoteBook.

Then I add a panel to each page of the NoteBook.

Inside the Panels I have some staticText controls and on one I have

three StaticBoxes with some controls in them.

How do I get the panels in the NoteBook to be able to scroll up and down

if the Frame is smaller than the height of the panels in the pages?

I know I am missing some sizers somewhere, but I don’t where I should

use the sizers. Do I need to use some StaticBoxSizers as well or

Flexgridsizers in the Panels?

Try using a wx.ScrolledWindow or a wx.lib.scroledpanel instead of the panels.

Robin Dunn

Software Craftsman

http://wxPython.org

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

The notebook pages. Basically wx.ScrolledWindow is a wx.Panel that also will automatically show a scrollbar if the physical size of the window is smaller than the virtual size, and one of the ways that the virtual size can be set is by using a sizer. You'll also need to call it's SetScrollRate to activate scrolling in the desired directions.

···

On 7/9/12 4:56 PM, Johan Geldenhuys wrote:

Hi,

I have no idea on how to implement this and can't find any good examples
of it.
Looking at the code I posted, the leftpanel is the one with my notebook
in. Do I change that to a scrolledpanel or the panels inside my notebook
pages?

--
Robin Dunn
Software Craftsman

I have no idea on how to implement this and can't find any good examples of
it.

There are examples of both in the wxPython demo, which is found under
Downloads on the wxPython website. If you don't have that, do get it,
it's a necessary tool for learning.

Where I declare my panel as wx.Panel(…), I can just use wx.ScrolledWindow instead and after that SetScrollRate(0,20)?

···

On Tue, Jul 10, 2012 at 11:51 AM, Robin Dunn robin@alldunn.com wrote:

On 7/9/12 4:56 PM, Johan Geldenhuys wrote:

Hi,

I have no idea on how to implement this and can’t find any good examples

of it.

Looking at the code I posted, the leftpanel is the one with my notebook

in. Do I change that to a scrolledpanel or the panels inside my notebook

pages?

The notebook pages. Basically wx.ScrolledWindow is a wx.Panel that also will automatically show a scrollbar if the physical size of the window is smaller than the virtual size, and one of the ways that the virtual size can be set is by using a sizer. You’ll also need to call it’s SetScrollRate to activate scrolling in the desired directions.

Robin Dunn

Software Craftsman

http://wxPython.org

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

The only way I can get this to work with my existing panel is:

In my panel module, I have:

import wx.lib.scrolledpanel as scrolled
class TabPanelConnectivity(scrolled.ScrolledPanel):

def _init_ctrls(self):
scrolled.ScrolledPanel.init(self, id=wxID_TABPANELCONNECTIVITY,
name=u’TabPanelConnectivity’, parent=prnt, pos=wx.Point(1081,
136), size=wx.Size(620, 859), style=wx.TAB_TRAVERSAL)

self.SetupScrolling()

What I have seen is that the scrollbars do not appear consistantly when the window is resized. Is there anything I have to change in the way I create my ScrolledPanel?

Thanks

···

On Tue, Jul 10, 2012 at 2:33 PM, Johan Geldenhuys johangeld@gmail.com wrote:

Where I declare my panel as wx.Panel(…), I can just use wx.ScrolledWindow instead and after that SetScrollRate(0,20)?

On Tue, Jul 10, 2012 at 11:51 AM, Robin Dunn robin@alldunn.com wrote:

On 7/9/12 4:56 PM, Johan Geldenhuys wrote:

Hi,

I have no idea on how to implement this and can’t find any good examples

of it.

Looking at the code I posted, the leftpanel is the one with my notebook

in. Do I change that to a scrolledpanel or the panels inside my notebook

pages?

The notebook pages. Basically wx.ScrolledWindow is a wx.Panel that also will automatically show a scrollbar if the physical size of the window is smaller than the virtual size, and one of the ways that the virtual size can be set is by using a sizer. You’ll also need to call it’s SetScrollRate to activate scrolling in the desired directions.

Robin Dunn

Software Craftsman

http://wxPython.org

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

Johan Geldenhuys wrote:

The only way I can get this to work with my existing panel is:

In my panel module, I have:

import wx.lib.scrolledpanel as scrolled
class TabPanelConnectivity(scrolled.ScrolledPanel):

def _init_ctrls(self):
      scrolled.ScrolledPanel.__init__(self, id=wxID_TABPANELCONNECTIVITY,
               name=u'TabPanelConnectivity', parent=prnt, pos=wx.Point(1081,
               136), size=wx.Size(620, 859), style=wx.TAB_TRAVERSAL)

     self.SetupScrolling()

What I have seen is that the scrollbars do not appear consistantly when
the window is resized. Is there anything I have to change in the way I
create my ScrolledPanel?

Please make a runnable, small as possible, sample application that
demonstrates the problem, and let us know the platform and wx version.
http://wiki.wxpython.org/MakingSampleApps

···

--
Robin Dunn
Software Craftsman

I found my issue.

When the user resize the frame, the size was saved to a prefs file that is part of my application in the exit method.
During execution, the size was recalled and used, resulting in the frame displayed in the same size as when it was closed.

The panel with the data on I want to scroll, is also smaller than what it should be to display and scroll.
It looks like that is the behavior of the panels in general.

Now I don’t save the resized frame when it exits. When the app opens and the frame is displayed, my panel is big enough to display everything. From here it can be resized again and the scrolling works.

Thanks

···

On Wed, Jul 11, 2012 at 11:25 AM, Robin Dunn robin@alldunn.com wrote:

Johan Geldenhuys wrote:

The only way I can get this to work with my existing panel is:

In my panel module, I have:

import wx.lib.scrolledpanel as scrolled

class TabPanelConnectivity(scrolled.ScrolledPanel):

def _init_ctrls(self):

  scrolled.ScrolledPanel.__init__(self, id=wxID_TABPANELCONNECTIVITY,

           name=u'TabPanelConnectivity', parent=prnt, pos=wx.Point(1081,

           136), size=wx.Size(620, 859), style=wx.TAB_TRAVERSAL)



 self.SetupScrolling()

What I have seen is that the scrollbars do not appear consistantly when

the window is resized. Is there anything I have to change in the way I

create my ScrolledPanel?

Please make a runnable, small as possible, sample application that

demonstrates the problem, and let us know the platform and wx version.

http://wiki.wxpython.org/MakingSampleApps

Robin Dunn

Software Craftsman

http://wxPython.org

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en