wxPython - problem dynamically adding widgets?

Fazan dr_burrito at yahoo.com
Mon Oct 4 22:14:32 CEST 2004


I'm trying to create a wxPython-based application with a list of
arbitrary widgets (in this case, progress bars).  I want my
application to dynamically add or delete widgets from the list based
on some user action.  I first tried using a BoxSizer, and dynamically
instantiated the new widgets and added them to the sizer at the right
time in my application.  This caused my app to hang every time.  Only
widgets which I created before displaying the main frame were working,
but subsequent widget creation caused the hanging behavior.

I've also played around with ListCtrl (with the LC_REPORT style) and
Grid objects to achieve the desired result with no success.  ListCtrls
allow text and images to be added; I had hoped to implement my own
progress bars (instead of using the Gauge class) by resizing images in
a list.  But the support for images in ListCtrls seems quite limited;
the image can only exist at the far left side of the list and is
limited to some fixed size.  In order to implement a progress bar I
would need more control over the placement and size of the image. 
Although Grids support some additional controls such as Choice and
CheckBox, they don't even support images and using a Grid seems
awfully heavyweight.

The sizer approach seems pretty straightforward but I can't figure out
why the app always locks up.  Anyone have ideas about how to solve
this?  TIA



More information about the Python-list mailing list