Hi,
Hi,
I have a frame with menu items and a single panel inside the frame
( the main panel ). When a menu item is selected, it clears out the
main panel, fetches the panel for that item and sets it to the main
panel. Each item panel contains a grid unique to that menu item. The
issue is that the grid will size for the initial width of the items
populating the grid, but not to the full size of the panel/frame.
What is the best way to size and then resize ( on window resize ) the
grid to the current size of the available panelframe?Below is my grid table code. I'll be happy to provide more code if
needed. I'm new to python and wxPython so please don't be too
harsh Thanks!#!/usr/bin/python
import wx
import wx.gridclass MyGridTable(wx.grid.PyGridTableBase):
def __init__(self, header,data, row_count, col_count):
wx.grid.PyGridTableBase.__init__(self)self\.colLabels = header self\.data = data self\.row\_count = row\_count self\.col\_count = col\_count def GetNumberRows\(self\): return len\(self\.data\) def GetNumberCols\(self\): return len\(self\.colLabels\) def IsEmptyCell\(self, row, col\): return self\.data\.get\(\(row, col\)\) is not None def GetValue\(self, row, col\): value = self\.data\.get\(\(row, col\)\) if value is not None: return value else: return '' def SetValue\(self, row, col, value\): self\.data\[\(row,col\)\] = value def GetColLabelValue\( self, col \): return self\.colLabels\[col\]
Each panel uses a Box sizer in its class file. Maybe there is a
better sizer to use? The main panel does not currently use a sizer
( uses sizer from each item panel )def __do_layout(self):
box = wx.BoxSizer(wx.VERTICAL)box\.Add \(self\.depth\_select\_combo\) box\.Add \(self\.this\_grid\_panel, wx\.EXPAND\) self\.parent\.SetSizer\(box\)
Does the grid magically size correctly if you adjust the size of the
frame just slightly by manually resizing it?
I can't tell from your code samples, but are you putting the grid
widget itself in a sizer? If so, you probably need to set the
proportion to 1 and include the wx.EXPAND style flag.
If that doesn't work see http://wiki.wxpython.org/MakingSampleApps
- Mike
- Mike
ยทยทยท
On Jul 17, 7:24 pm, wtcfg <wtc...@gmail.com> wrote: