Problems using Remove() on sizers..

Hi Søren,

···

On Mon, Jul 7, 2008 at 3:48 PM, Søren Nielsen soren.skou.nielsen@gmail.com wrote:

How do I remove the panels from the underpanel? … wx.Sizer has Remove() … so the only way I know is to do a Remove() for each item… which is stored in an item list… … Sometimes i do not want to clear all of the items … only some… isn’t doing a Remove on the sizer the only way to do this?

You can call underpanel.RemoveChild(item), probably. And as Josiah said, you can also do item.Destroy().

See also info at: http://wxpython.org/docs/api/wx.Window-class.html#RemoveChild, which suggests that you shouldn’t call RemoveChild but indeed do item.Destroy() / item.Hide().

Cheers,

–Tim

Hi,

    How do I remove the panels from the underpanel? .. wx.Sizer has
    Remove() ... so the only way I know is to do a Remove() for each
    item.. which is stored in an item list.. .. Sometimes i do not
    want to clear all of the items .. only some.. isn't doing a Remove
    on the sizer the only way to do this?

You can call underpanel.RemoveChild(item), probably. And as Josiah said, you can also do item.Destroy().

See also info at: wxPython API Documentation — wxPython Phoenix 4.2.2 documentation, which suggests that you shouldn't call RemoveChild but indeed do item.Destroy() / item.Hide().

Cheers,

--Tim

On the off chance that you might want to use that panel again later, you should use the sizer's Detach() method instead.

···

On Mon, Jul 7, 2008 at 3:48 PM, Søren Nielsen > <soren.skou.nielsen@gmail.com <mailto:soren.skou.nielsen@gmail.com>> > wrote:

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

Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org

Søren,

You're probably correct. Sometimes you can see an item getting added. One way around this is to call Freeze() before adding the panel and then Thaw() afterwards. By the way, which method were you referring to when you said that it worked?

···

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

Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org

Thanks! that worked like a charm!

A totally different question that puzzels me is that when you click the test button... in a very small instant you see a small box in the corner just before the panel is added to the list.... any idea what might be causing this?? It looks like its creating the panel.. then resizing it to the correct size..

Thanks,
Soren

On Mon, Jul 7, 2008 at 4:12 PM, Mike Driscoll <mike@pythonlibrary.org > <mailto:mike@pythonlibrary.org>> wrote:

    Hi,

        On Mon, Jul 7, 2008 at 3:48 PM, Søren Nielsen > <soren.skou.nielsen@gmail.com > <mailto:soren.skou.nielsen@gmail.com> > <mailto:soren.skou.nielsen@gmail.com > <mailto:soren.skou.nielsen@gmail.com>>> wrote:

           How do I remove the panels from the underpanel? .. wx.Sizer has
           Remove() ... so the only way I know is to do a Remove() for
        each
           item.. which is stored in an item list.. .. Sometimes i do not
           want to clear all of the items .. only some.. isn't doing a
        Remove
           on the sizer the only way to do this?

        You can call underpanel.RemoveChild(item), probably. And as
        Josiah said, you can also do item.Destroy().

        See also info at:
        wxPython API Documentation — wxPython Phoenix 4.2.2 documentation,
        which suggests that you shouldn't call RemoveChild but indeed
        do item.Destroy() / item.Hide().

        Cheers,

        --Tim

    On the off chance that you might want to use that panel again
    later, you should use the sizer's Detach() method instead.

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

    Blog: http://blog.pythonlibrary.org
    Python Extension Building Network: http://www.pythonlibrary.org

    _______________________________________________
    wxpython-users mailing list

    wxpython-users@lists.wxwidgets.org
    <mailto:wxpython-users@lists.wxwidgets.org>
    http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

I tried to use both Destroy() and Hide()… both worked… I didn’t use the detach since i don’t need to save the panel for later… but I might in the future…

Thanks for freeze and thaw! that worked too.

···

On Mon, Jul 7, 2008 at 5:41 PM, Mike Driscoll mike@pythonlibrary.org wrote:

Søren,

You’re probably correct. Sometimes you can see an item getting added. One way around this is to call Freeze() before adding the panel and then Thaw() afterwards. By the way, which method were you referring to when you said that it worked?


Mike Driscoll

Blog: http://blog.pythonlibrary.org

Python Extension Building Network: http://www.pythonlibrary.org

Thanks! that worked like a charm!

A totally different question that puzzels me is that when you click the test button… in a very small instant you see a small box in the corner just before the panel is added to the list… any idea what might be causing this?? It looks like its creating the panel… then resizing it to the correct size…

Thanks,

Soren

On Mon, Jul 7, 2008 at 4:12 PM, Mike Driscoll <mike@pythonlibrary.org mailto:mike@pythonlibrary.org> wrote:

Hi,







    On Mon, Jul 7, 2008 at 3:48 PM, Søren Nielsen

    <soren.skou.nielsen@gmail.com

    <mailto:soren.skou.nielsen@gmail.com>

    <mailto:soren.skou.nielsen@gmail.com

    <mailto:soren.skou.nielsen@gmail.com>>> wrote:



       How do I remove the panels from the underpanel? .. wx.Sizer has

       Remove() ... so the only way I know is to do a Remove() for

    each

       item.. which is stored in an item list.. .. Sometimes i do not

       want to clear all of the items .. only some.. isn't doing a

    Remove

       on the sizer the only way to do this?





    You can call underpanel.RemoveChild(item), probably. And as

    Josiah said, you can also do item.Destroy().



    See also info at:

    [http://wxpython.org/docs/api/wx.Window-class.html#RemoveChild](http://wxpython.org/docs/api/wx.Window-class.html#RemoveChild),

    which suggests that you shouldn't call RemoveChild but indeed

    do item.Destroy() / item.Hide().



    Cheers,



    --Tim







On the off chance that you might want to use that panel again

later, you should use the sizer's Detach() method instead.



-------------------

Mike Driscoll



Blog:   [http://blog.pythonlibrary.org](http://blog.pythonlibrary.org)

Python Extension Building Network:     [http://www.pythonlibrary.org](http://www.pythonlibrary.org)



_______________________________________________

wxpython-users mailing list



wxpython-users@lists.wxwidgets.org

mailto:wxpython-users@lists.wxwidgets.org

[http://lists.wxwidgets.org/mailman/listinfo/wxpython-users](http://lists.wxwidgets.org/mailman/listinfo/wxpython-users)

wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users