oddness with wxnotebook...

Does anyone see an obvious reason why checkbox widgets would work with this pattern, but not wx notebooks? http://pastebin.com/m57bee079 vs http://pastebin.com/m3c044b29

Thanks.

Lawson

Lawson English wrote:

Does anyone see an obvious reason why checkbox widgets would work with this pattern, but not wx notebooks? http://pastebin.com/m57bee079 vs http://pastebin.com/m3c044b29

Thanks.

Lawson

I'm not really sure what you're trying to do, but I fixed the notebook so that you could at least see it. See attached.

m57bee079.py (1.31 KB)

···

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org

Thanks. The idea was to be able to take a panel with a wx.Notebook embedded in it and use it the same way as a panel with a wx.CheckListBox embedded in it, but apparently they are not equivalent for that purpose, though they both seem to be in the same level of the class hierarchy:

http://docs.wxwidgets.org/2.6/wx_wxnotebook.html
http://docs.wxwidgets.org/2.6/wx_wxcheckbox.html

L

Mike Driscoll wrote:

···

Lawson English wrote:

Does anyone see an obvious reason why checkbox widgets would work with this pattern, but not wx notebooks? http://pastebin.com/m57bee079 vs http://pastebin.com/m3c044b29

Thanks.

Lawson

I'm not really sure what you're trying to do, but I fixed the notebook so that you could at least see it. See attached.

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org

Lawson English wrote:

Mike Driscoll wrote:
> Lawson English wrote:
>> Does anyone see an obvious reason why checkbox widgets would work
>> with this pattern, but not wx notebooks?
>> http://pastebin.com/m57bee079 vs http://pastebin.com/m3c044b29
>>
>>
>> Thanks.
>>
>> Lawson
>
> I'm not really sure what you're trying to do, but I fixed
the notebook
> so that you could at least see it. See attached.
>
> -------------------
> Mike Driscoll
>
> Blog: http://blog.pythonlibrary.org
>

Thanks. The idea was to be able to take a panel with a wx.Notebook
embedded in it and use it the same way as a panel with a
wx.CheckListBox
embedded in it, but apparently they are not equivalent for
that purpose,
though they both seem to be in the same level of the class hierarchy:

wxNotebook
wxCheckBox

L

Like Mike, I don't really understand what you are asking for. The
problem with your notebook sample is that you aren't adding the
wx.Notebook instance to a sizer, so it is ending up so small that you
can barely see it. I guess the CheckListBox just happens to have a
default size which is useable, whereas the default size for the notebook
is not.

Try passing "size=(300, 100)" to the wx.Notebook constructor. It would
be better to use a sizer though.

Hope that helps,

Simon

King Simon-NFHD78 wrote:
[...]

Like Mike, I don't really understand what you are asking for. The
problem with your notebook sample is that you aren't adding the
wx.Notebook instance to a sizer, so it is ending up so small that you
can barely see it. I guess the CheckListBox just happens to have a
default size which is useable, whereas the default size for the notebook
is not.

Try passing "size=(300, 100)" to the wx.Notebook constructor. It would
be better to use a sizer though.

Hope that helps,

Simon
  
OK, thanks.

The idea is to have widget panels (with or without sizers) that can be separately tested for validation
and then embedded in larger meta-panels without having to change the code for the individual panels

I.E., a bunch of checkboxes set parameters, and I get it working for those options then embed the checkboxes in
a notebook widget, and then have a top level layout that includes one or more notebooks.

IT seemed that the notebook didn't work quite like the textctrls. I guess because there's no default size for them.

Lawson

King Simon-NFHD78 wrote:

[…]

Like Mike, I don’t really understand what you are asking for. The

problem with your notebook sample is that you aren’t adding the

wx.Notebook instance to a sizer, so it is ending up so small that you

can barely see it. I guess the CheckListBox just happens to have a

default size which is useable, whereas the default size for the notebook

is not.

Try passing “size=(300, 100)” to the wx.Notebook constructor. It would

be better to use a sizer though.

Hope that helps,

Simon

OK, thanks.

The idea is to have widget panels (with or without sizers) that can be separately tested for validation

and then embedded in larger meta-panels without having to change the code for the individual panels

I.E., a bunch of checkboxes set parameters, and I get it working for those options then embed the checkboxes in

a notebook widget, and then have a top level layout that includes one or more notebooks.

If I understand this correctly, you want a hiearchy like this:

–Frame
----Panel1
------Notebook
--------Panel2
----------A lot of checkboxes

Where Panel2 can be used in its own class–Yes? That’s not a problem at all.

IT seemed that the notebook didn’t work quite like the textctrls. I guess because there’s no default size for them.

What textctrls? I didn’t see any in your code sample. Certainly you can put
wxTextCtrls inside wxNotebooks.

Che

···

On Fri, Apr 24, 2009 at 3:58 PM, Lawson English lenglish5@cox.net wrote:

C M wrote:

    King Simon-NFHD78 wrote:
    [...]

        Like Mike, I don't really understand what you are asking for. The
        problem with your notebook sample is that you aren't adding the
        wx.Notebook instance to a sizer, so it is ending up so small
        that you
        can barely see it. I guess the CheckListBox just happens to have a
        default size which is useable, whereas the default size for
        the notebook
        is not.

        Try passing "size=(300, 100)" to the wx.Notebook constructor.
        It would
        be better to use a sizer though.

        Hope that helps,

        Simon
         
    OK, thanks.

    The idea is to have widget panels (with or without sizers) that
    can be separately tested for validation
    and then embedded in larger meta-panels without having to change
    the code for the individual panels

    I.E., a bunch of checkboxes set parameters, and I get it working
    for those options then embed the checkboxes in
    a notebook widget, and then have a top level layout that includes
    one or more notebooks.

If I understand this correctly, you want a hiearchy like this:

--Frame
----Panel1
------Notebook
--------Panel2
----------A lot of checkboxes

Where Panel2 can be used in its own class--Yes? That's not a problem at all.

    IT seemed that the notebook didn't work quite like the textctrls.
    I guess because there's no default size for them.

What textctrls? I didn't see any in your code sample. Certainly you can put
wxTextCtrls inside wxNotebooks.
Che

My original sample code was getting different behavior from using panels with txtctrols vs panels with notebooks. Apparently a default size/sizer issue. As long as I understand how the pattern should go I can accommodate it in my design. I was just using the wrong basic pattern to embed things in the hierarchy.

Lawson

···

On Fri, Apr 24, 2009 at 3:58 PM, Lawson English <lenglish5@cox.net > <mailto:lenglish5@cox.net>> wrote:

C M wrote:

If I understand this correctly, you want a hiearchy like this:

--Frame
----Panel1
------Notebook
--------Panel2
----------A lot of checkboxes

OK, so the solution is to use a sizer in each level of the hierarchy:

--Frame
----mainPanel #sizer for main panel
------listctrlpanel #sizer for listctrlpanel
---------listctrl
------NBPanel1 #sizer for NBPanel1
---------Notebook1
-----------NBcheckbox panel1 #sizer here as well
-------------A lot of checkboxes
-----------MBcheckbox panel2 #sizer here as well
-------------A lot of checkboxes
---------Notebook2
-----------otherstuff panel1 #sizer here as well
-------------A lot of otherstuff
-----------otherstuff panel2 #sizer here as well
-------------A lot of otherstuff

As long as I have a sizer set for each layer of the hierarchy, things work as expected (I think).

So thanks for the tip.

Lawson

This strikes me as overkill and probably confusing. First, in terms of the clarity,
are you really naming sizers as, e.g., “NBPanel1”? To me, only a panel

should be named a panel (thinking in terms of maintaining your code
later). Maybe better to name it NBSizer1 or something like that.

Then, I am not sure how to picture your layout, but I doubt you need
this many sizers. Could you describe what you want to see in the frame?

E.g., do you want the listCtrlpanel on top and the two notebooks one
below the next below that, or would you want things to move from left
to right, or a mixture of the two?

Basically, you could just have a frame, a panel on it to put everything,

a BoxSizer on that panel, and then your 3 main objects. Then,
each page of the notebooks would be a panel with an associated
sizer. You don’t need a 1:1 correspondence of object:sizer.

HTH,
Che

···

On Fri, Apr 24, 2009 at 6:00 PM, Lawson English lenglish5@cox.net wrote:

C M wrote:

If I understand this correctly, you want a hiearchy like this:

–Frame

----Panel1

------Notebook

--------Panel2

----------A lot of checkboxes

OK, so the solution is to use a sizer in each level of the hierarchy:

–Frame

----mainPanel #sizer for main panel

------listctrlpanel #sizer for listctrlpanel

---------listctrl

------NBPanel1 #sizer for NBPanel1

---------Notebook1

-----------NBcheckbox panel1 #sizer here as well

-------------A lot of checkboxes

-----------MBcheckbox panel2 #sizer here as well

-------------A lot of checkboxes

---------Notebook2

-----------otherstuff panel1 #sizer here as well

-------------A lot of otherstuff

-----------otherstuff panel2 #sizer here as well

-------------A lot of otherstuff

As long as I have a sizer set for each layer of the hierarchy, things work as expected (I think).

So thanks for the tip.

C M wrote:

    C M wrote:

        If I understand this correctly, you want a hiearchy like this:

        --Frame
        ----Panel1
        ------Notebook
        --------Panel2
        ----------A lot of checkboxes

    OK, so the solution is to use a sizer in each level of the hierarchy:

    --Frame
    ----mainPanel #sizer for main panel
    ------listctrlpanel #sizer for listctrlpanel
    ---------listctrl
    ------NBPanel1 #sizer for NBPanel1
    ---------Notebook1
    -----------NBcheckbox panel1 #sizer here as well
    -------------A lot of checkboxes
    -----------MBcheckbox panel2 #sizer here as well
    -------------A lot of checkboxes
    ---------Notebook2
    -----------otherstuff panel1 #sizer here as well
    -------------A lot of otherstuff
    -----------otherstuff panel2 #sizer here as well
    -------------A lot of otherstuff

    As long as I have a sizer set for each layer of the hierarchy,
    things work as expected (I think).

    So thanks for the tip.

This strikes me as overkill and probably confusing. First, in terms of the clarity,
are you really naming sizers as, e.g., "NBPanel1"? To me, only a panel
should be named a panel (thinking in terms of maintaining your code
later). Maybe better to name it NBSizer1 or something like that.

Then, I am not sure how to picture your layout, but I doubt you need
this many sizers. Could you describe what you want to see in the frame?
E.g., do you want the listCtrlpanel on top and the two notebooks one
below the next below that, or would you want things to move from left
to right, or a mixture of the two?

Basically, you could just have a frame, a panel on it to put everything,
a BoxSizer on that panel, and then your 3 main objects. Then,
each page of the notebooks would be a panel with an associated
sizer. You don't need a 1:1 correspondence of object:sizer.

Yeah, its overkill I guess. My actual setup would be something like this:

--Frame
----mainPanel #sizer for main panel
------listctrlpanel #sizer for listctrlpanel
---------listctrl
------NBPanel1 #sizer for NBPanel1
---------Notebook1
-----------NBcheckbox panel1 #sizer here as well ?
-------------A lot of checkboxes
-----------NBcheckbox panel2 #sizer here as well ?
-------------A lot of checkboxes

It seems I need a sizer for each container panel though, even if there's only one widget
in that panel that doesn't have a default size. IE, NBPanel1 needs to have a sizer, even if
there's only one widget (the notebook) in it, otherwise the notebook doesn't show.

Lawson

···

On Fri, Apr 24, 2009 at 6:00 PM, Lawson English <lenglish5@cox.net > <mailto:lenglish5@cox.net>> wrote:

Lawson English wrote:

C M wrote:

    C M wrote:

        If I understand this correctly, you want a hiearchy like this:

        --Frame
        ----Panel1
        ------Notebook
        --------Panel2
        ----------A lot of checkboxes

    OK, so the solution is to use a sizer in each level of the hierarchy:

    --Frame
    ----mainPanel #sizer for main panel
    ------listctrlpanel #sizer for listctrlpanel
    ---------listctrl
    ------NBPanel1 #sizer for NBPanel1
    ---------Notebook1
    -----------NBcheckbox panel1 #sizer here as well
    -------------A lot of checkboxes
    -----------MBcheckbox panel2 #sizer here as well
    -------------A lot of checkboxes
    ---------Notebook2
    -----------otherstuff panel1 #sizer here as well
    -------------A lot of otherstuff
    -----------otherstuff panel2 #sizer here as well
    -------------A lot of otherstuff

    As long as I have a sizer set for each layer of the hierarchy,
    things work as expected (I think).

    So thanks for the tip.

This strikes me as overkill and probably confusing. First, in terms of the clarity,
are you really naming sizers as, e.g., "NBPanel1"? To me, only a panel
should be named a panel (thinking in terms of maintaining your code
later). Maybe better to name it NBSizer1 or something like that.

Then, I am not sure how to picture your layout, but I doubt you need
this many sizers. Could you describe what you want to see in the frame?
E.g., do you want the listCtrlpanel on top and the two notebooks one
below the next below that, or would you want things to move from left
to right, or a mixture of the two?
Basically, you could just have a frame, a panel on it to put everything,
a BoxSizer on that panel, and then your 3 main objects. Then,
each page of the notebooks would be a panel with an associated
sizer. You don't need a 1:1 correspondence of object:sizer.

Yeah, its overkill I guess. My actual setup would be something like this:

--Frame
----mainPanel #sizer for main panel
------listctrlpanel #sizer for listctrlpanel
---------listctrl
------NBPanel1 #sizer for NBPanel1
---------Notebook1
-----------NBcheckbox panel1 #sizer here as well ?
-------------A lot of checkboxes
-----------NBcheckbox panel2 #sizer here as well ?
-------------A lot of checkboxes

It seems I need a sizer for each container panel though, even if there's only one widget
in that panel that doesn't have a default size. IE, NBPanel1 needs to have a sizer, even if
there's only one widget (the notebook) in it, otherwise the notebook doesn't show.

Lawson

It's kind of late in the game, but can you send a small runnable app? Maybe Che or I or one of the others can give you come clues.

Mike

···

On Fri, Apr 24, 2009 at 6:00 PM, Lawson English <lenglish5@cox.net >> <mailto:lenglish5@cox.net>> wrote:

Lawson English wrote:

It seems I need a sizer for each container

If you strip your statement to just the above, and then add "unless the container already has the ability to manage the size and/or position of its children." then I think a lot of the confusion will evaporate.

Some examples of the exceptions are

* A frame with just one child will resize it to fill the client area.
* Notebooks automatically resize their page windows to fill the area not used by the tabs
* Splitter windows will resize the one or two children to fill the areas on each side of the sash.
* etc.

The above rule can then be reapplied to the content of the containers placed in the frame, notebook, splitter, etc. windows.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

Lawson English wrote:

It seems I need a sizer for each container

If you strip your statement to just the above, and then add "unless the container already has the ability to manage the size and/or position of its children." then I think a lot of the confusion will evaporate.

Some examples of the exceptions are

* A frame with just one child will resize it to fill the client area.
* Notebooks automatically resize their page windows to fill the area not used by the tabs
* Splitter windows will resize the one or two children to fill the areas on each side of the sash.
* etc.

The above rule can then be reapplied to the content of the containers placed in the frame, notebook, splitter, etc. windows.

Great. That's kinda what I finally realized: do it this way unless the container does it for you already.

And notebooks and sashes are both containers and controls I guess.

Lawson