Refreshing GridBagSizer

S

Steve S

Hey guys,

I'm stuck with using a GridBagSizer (wxPython) in a GUI Dialog and am having
a frustrating time with refreshing it properly.

Essentially, I've got to refresh the contents of the GridBagSizer on
occasion with new values. The way I'm doing it works 4 times out of 5 but
on the 5th, *all* of the grid objects that are set to various positions in
the GBS are set to (0,0) :|

So, the way I refresh it is that I keep a record of all grid objects
inserted into the GridBagSizer and on refresh, I first iterate through that
list and destroy everything in it. I then call Clear() and then Layout()
and start adding new grid objects.
i.e. I do this:
for obj in self.gridObjects:
obj.Destroy()
self.gridObjects = []
self.gbs.Clear()
self.gbs.Layout
// Add all new gridObjects, recording them in self.gridObjects

Again, this works most all the time *except* that sometimes all newly added
grid objects will end up at (0,0) in the GBS :|

Am I refreshing it correctly? Has anybody experienced a similar issue?

I appreciate any help :)
Steve
 
K

kyosohma

Hey guys,

I'm stuck with using a GridBagSizer (wxPython) in a GUI Dialog and am having
a frustrating time with refreshing it properly.

Essentially, I've got to refresh the contents of the GridBagSizer on
occasion with new values. The way I'm doing it works 4 times out of 5 but
on the 5th, *all* of the grid objects that are set to various positions in
the GBS are set to (0,0) :|

So, the way I refresh it is that I keep a record of all grid objects
inserted into the GridBagSizer and on refresh, I first iterate through that
list and destroy everything in it. I then call Clear() and then Layout()
and start adding new grid objects.
i.e. I do this:
for obj in self.gridObjects:
obj.Destroy()
self.gridObjects = []
self.gbs.Clear()
self.gbs.Layout
// Add all new gridObjects, recording them in self.gridObjects

Again, this works most all the time *except* that sometimes all newly added
grid objects will end up at (0,0) in the GBS :|

Am I refreshing it correctly? Has anybody experienced a similar issue?

I appreciate any help :)
Steve

You'll probably do better if you email the wxPython user's group for
these kinds of things. But I'll take a shot at it anyway.

Looking at the GridBagSizer's docs, I found it has the following
method: CheckForIntersection. You could use that to make sure there
are no intersections and then handle it when they occur.

See the docs for more info:

http://www.wxpython.org/docs/api/wx.GridBagSizer-class.html

The mailing list is here:

http://wxpython.org/maillist.php

Without knowing what your layout scheme is or how you add the widgets
to the sizer, it's difficult to give a more specific answer. Since you
say it's a dialog, you might want to consider using a simpler sizer or
a group of simpler sizers nested in one another. There's an entry on
the wiki that might be helpful to you as well.

http://wiki.wxpython.org/UsingSizers

Hope that helps.

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top