Discussion:
wxPython: how to update a panel content/layout according to a variable content
F. GEIGER
2004-11-20 15:37:36 UTC
Permalink
wxWindow has Update and Refresh methods. You can override the one of your
wxPanel, where you can call all its children to update/refresh themselves.
wxPanel's update could be triggered by a timer event, mouse event or
whatever.

I do such things preferably in timers owned by the widgets themselves.

HTH
Franz GEIGER



"Lo?c Mah?" <loic.mahe at free.fr> schrieb im Newsbeitrag
Hello
I have a problem to update the content of a wx.Panel already displayed
after changing a variable, used to define the wx.Panel content.
DataList: is a list containing some data
CustomPanel: is a derived class of wx.Panel,
it contains one sizer which contains a smaller panel for each
element of the DataList list
After having displayed CustomPanel on the screen, the elements in
DataList change (after a user action like clicking on button)
I would like to refresh the CustomPanel to take into account the
changes of the DataList list
Is there a kind of Refresh/Update function which could update the
CustomPanel so
that evry sizers and panles contained by this CustomPanel are redrawn
according to the current value of DataList ?
or do you have to write your own update/refresh method for Panel and
Windows objects ?
and are you obliged to detroy the CustomPanel object and re-create a
new one?
I would appreciate any hint/reference to do this, and also a code
sample if possible.
Thanks.
Lo?c
Lo?c Mah?
2004-11-19 16:19:54 UTC
Permalink
Hello

I have a problem to update the content of a wx.Panel already displayed
after changing a variable, used to define the wx.Panel content.

I have the following elements in my code:

DataList: is a list containing some data

CustomPanel: is a derived class of wx.Panel,
it contains one sizer which contains a smaller panel for each
element of the DataList list


After having displayed CustomPanel on the screen, the elements in
DataList change (after a user action like clicking on button)

I would like to refresh the CustomPanel to take into account the
changes of the DataList list
Is there a kind of Refresh/Update function which could update the
CustomPanel so
that evry sizers and panles contained by this CustomPanel are redrawn
according to the current value of DataList ?
or do you have to write your own update/refresh method for Panel and
Windows objects ?
and are you obliged to detroy the CustomPanel object and re-create a
new one?


I would appreciate any hint/reference to do this, and also a code
sample if possible.

Thanks.

Lo?c
Lo?c Mah?
2004-11-29 13:35:11 UTC
Permalink
Thanks for the answer.

I will try the method you talked about.

For the moment, I am creating a new sizer and new panel
and call the SetSizer(...) and SetAutoLayout(...)
but this is not satisfying me.

Lo?c
Post by F. GEIGER
wxWindow has Update and Refresh methods. You can override the one of your
wxPanel, where you can call all its children to update/refresh themselves.
wxPanel's update could be triggered by a timer event, mouse event or
whatever.
I do such things preferably in timers owned by the widgets themselves.
HTH
Franz GEIGER
Loading...