The app I'm making consists of a wxTreeCtrl and a wxPanel managed by a
wxSplitterWindow. Clicked on the left hand sided items in the treeCtrl
adds a wxNotebook to the panel. My problem is that when I select the
next item in treeCtrl the previous notebook remains in the background
(I know this as a tab from the previous NB is visible from
behind). It does not seem to be a refresh problem as the remaining tab
is clicable.
I was under the impression that 'del'ing the old NB before adding the
new NB would get rid off all references the old NB object, the NB
object is stored in a list and del'ed when a new one is created.
I would prefer keeping the NB object around and only 'swap' it unto
the panel when it is needed.
In short: How does one add and delete children from a wxPanel, even if
the children are still around ?
The app I'm making consists of a wxTreeCtrl and a wxPanel managed by a
wxSplitterWindow. Clicked on the left hand sided items in the treeCtrl
adds a wxNotebook to the panel. My problem is that when I select the
next item in treeCtrl the previous notebook remains in the background
(I know this as a tab from the previous NB is visible from
behind). It does not seem to be a refresh problem as the remaining tab
is clicable.
I was under the impression that 'del'ing the old NB before adding the
new NB would get rid off all references the old NB object, the NB
object is stored in a list and del'ed when a new one is created.
No, in Python "del nb" only decrements the reference count of the Python object by deleting the "nb" name. If there are other variables referencing the object (so the reference count > 0) then it stays around. In wxPython the issue is complicated by the fact that there is a C++ object underneath and there is not necessarily a 1-1 corespondence with Python objects. When you create a wxPython window then normally the parent window "owns" the C++ object and matching Python shadow objects can come and go as needed without affecting the C++ object at all.
To truly delete a wxPython window's C++ object (any class derived from wxWindow) then you can call the "window.Delete()" method.
I would prefer keeping the NB object around and only 'swap' it unto
the panel when it is needed.
In short: How does one add and delete children from a wxPanel, even if
the children are still around ?
If you don't want to delete the child window then you can reparent it to another parent window, using window.Reparent(newParent). (Non top-level windows must always have a parent.) If all you want to do is hide the window then just use "window.Show(false)"
···
--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters? http://wxPython.org Relax with wxPython!
>
> The app I'm making consists of a wxTreeCtrl and a wxPanel managed by a
> wxSplitterWindow. Clicked on the left hand sided items in the treeCtrl
> adds a wxNotebook to the panel. My problem is that when I select the
> next item in treeCtrl the previous notebook remains in the background
> (I know this as a tab from the previous NB is visible from
> behind). It does not seem to be a refresh problem as the remaining tab
> is clicable.
>
> I was under the impression that 'del'ing the old NB before adding the
> new NB would get rid off all references the old NB object, the NB
> object is stored in a list and del'ed when a new one is created.
> No, in Python "del nb" only decrements the reference count of the Python
>object by deleting the "nb" name. If there are other variables referencing
>the object (so the reference count > 0) then it stays around. In wxPython the
>issue is complicated by the fact that there is a C++ object underneath and
>there is not necessarily a 1-1 corespondence with Python objects. When you
>create a wxPython window then normally the parent window "owns" the C++ object
>and matching Python shadow objects can come and go as needed without affecting
>the C++ object at all.
>To truly delete a wxPython window's C++ object (any class derived from
>wxWindow) then you can call the "window.Delete()" method.
>
> I would prefer keeping the NB object around and only 'swap' it unto
> the panel when it is needed.
>
> In short: How does one add and delete children from a wxPanel, even if
> the children are still around ?
> If you don't want to delete the child window then you can reparent it to
>another parent window, using window.Reparent(newParent). (Non top-level
>windows must always have a parent.) If all you want to do is hide the window
>then just use "window.Show(false)"
Ah yes, thats the thing. I now populate a dictionary with the NB objects
and a appropiate key, and dict[key].Show([true][false]) as neccessary. Much less
overhead with improved GUI responce. Must go through wxWindow's methods a bit
more carefully I gues.
greatly appreciated
regards
thys
···
On Thu, 18 Jan 2001, Robin Dunn wrote:
--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters? http://wxPython.org Relax with wxPython!
I'm trying to create a nonresizable frame and failing miserably.
Any help appreciated, as always.
Two possibilities, (or a combination...) Play with the style flags for the wxFrame. wxDEFAULT_FRAME_STYLE is a combination of others, one of which gives the resizeable border. Remove that flag and it should not be user resizeable anymore. The other option is to call the SetSizeHints method.
···
--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters? http://wxPython.org Relax with wxPython!
\A matter of the mind thinking one thing and the fingers typing another, no
doubt... just for the sake of possible confusion though, that should be the
Destroy method, not Delete... unless there's some Delete method that I've
never used...!
Have a great day,
Chris
···
-------------------------------------------------------------------------
Chris Fama <mailto:Chris.Fama@uq.net.au> Phone:(07) 3870 5639
Brisbane, Australia Mobile:(0400) 833 700
-------------------------------------------------------------------------
Suppose you were an idiot. And suppose you were a member of
Congress. But I repeat myself. -- Mark Twain
-----Original Message-----
From: wxpython-users-admin@lists.sourceforge.net
[mailto:wxpython-users-admin@lists.sourceforge.net]On Behalf Of Thys
Meintjes
Sent: Friday, 19 January 2001 4:37 AM
To: wxpython-users@lists.sourceforge.net
Subject: Re: [wxPython] managing wxPanel's children
On Thu, 18 Jan 2001, Robin Dunn wrote:
> >
> > The app I'm making consists of a wxTreeCtrl and a wxPanel managed by a
> > wxSplitterWindow. Clicked on the left hand sided items in the treeCtrl
> > adds a wxNotebook to the panel. My problem is that when I select the
> > next item in treeCtrl the previous notebook remains in the background
> > (I know this as a tab from the previous NB is visible from
> > behind). It does not seem to be a refresh problem as the remaining tab
> > is clicable.
> >
> > I was under the impression that 'del'ing the old NB before adding the
> > new NB would get rid off all references the old NB object, the NB
> > object is stored in a list and del'ed when a new one is created.
>
> No, in Python "del nb" only decrements the reference count of
the Python
>object by deleting the "nb" name. If there are other variables
referencing
>the object (so the reference count > 0) then it stays around.
In wxPython the
>issue is complicated by the fact that there is a C++ object
underneath and
>there is not necessarily a 1-1 corespondence with Python
objects. When you
>create a wxPython window then normally the parent window "owns"
the C++ object
>and matching Python shadow objects can come and go as needed
without affecting
>the C++ object at all.
>To truly delete a wxPython window's C++ object (any class derived from
>wxWindow) then you can call the "window.Delete()" method.
>
>
> >
> > I would prefer keeping the NB object around and only 'swap' it unto
> > the panel when it is needed.
> >
> > In short: How does one add and delete children from a wxPanel, even if
> > the children are still around ?
>
> If you don't want to delete the child window then you can
reparent it to
>another parent window, using window.Reparent(newParent). (Non top-level
>windows must always have a parent.) If all you want to do is
hide the window
>then just use "window.Show(false)"
Ah yes, thats the thing. I now populate a dictionary with the NB objects
and a appropiate key, and dict[key].Show([true][false]) as
neccessary. Much less
overhead with improved GUI responce. Must go through wxWindow's
methods a bit
more carefully I gues.
greatly appreciated
regards
thys
>
> --
> Robin Dunn
> Software Craftsman
> robin@AllDunn.com Java give you jitters?
> http://wxPython.org Relax with wxPython!
>
>
>
> _______________________________________________
> wxPython-users mailing list
> wxPython-users@lists.sourceforge.net
> http://lists.sourceforge.net/lists/listinfo/wxpython-users