By the time you use the WIT all layout is done, where in init of
your panel that is not the case.
Maybe create a method ‘upgradeGridSize’ or something along those
lines and call it using wx.CallAfter.
Werner
···
Hi Steve,
On 7/18/2014 12:59, steve wrote:
Hi,
I have placed a wx.grid on a panel,
I try to get panel's width, and then use this width to set
grid’s column size:
def
init(self, parent, *args, **kwargs):
wx.Panel.__init__(self, parent, *args, **kwargs)
self.my_grid = SidePanelGrid(self)
self.mainSizer = wx.BoxSizer(wx.VERTICAL)
self.mainSizer.Add(self.capacity_grid, 0, wx.ALIGN_LEFT)
self.SetSizer(self.mainSizer)
widthx,heightx = self.GetSize()
print "widthx: ", widthx
self.my_grid.SetColSize(0, widthx)
When I inspect the widget inspection tool, I see that the panel
has size (220, 720)
but above "widthx" print "20" (should be 220)
what causes the difference?
When should I upgrade the size of grid column exactly?
···
On Friday, July 18, 2014 2:05:52 PM UTC+3, werner wrote:
Hi Steve,
On 7/18/2014 12:59, steve wrote:
Hi,
I have placed a wx.grid on a panel,
I try to get panel's width, and then use this width to set
grid’s column size:
def
init(self, parent, *args, **kwargs):
wx.Panel.__init__(self, parent, *args, **kwargs)
self.my_grid = SidePanelGrid(self)
self.mainSizer = wx.BoxSizer(wx.VERTICAL)
self.mainSizer.Add(self.capacity_grid, 0, wx.ALIGN_LEFT)
self.SetSizer(self.mainSizer)
widthx,heightx = self.GetSize()
print "widthx: ", widthx
self.my_grid.SetColSize(0, widthx)
When I inspect the widget inspection tool, I see that the panel
has size (220, 720)
but above "widthx" print "20" (should be 220)
what causes the difference?
By the time you use the WIT all layout is done, where in __init__ of
your panel that is not the case.
Maybe create a method 'upgradeGridSize' or something along those
self.SetSizer(self.mainSizer)
widthx,heightx = self.GetSize()
print "widthx: ", widthx
self.my_grid.SetColSize(0, widthx)
When I inspect the widget inspection tool, I see that
the panel has size (220, 720)
but above "widthx" print "20" (should be 220)
what causes the difference?
By the time you use the WIT all layout is done, where in
init of your panel that is not the case.
Maybe create a method 'upgradeGridSize' or something along
those lines and call it using wx.CallAfter.
Werner
–
You received this message because you are subscribed to the Google
Groups “wxPython-users” group.
To unsubscribe from this group and stop receiving emails from it,