Can anyone see anything odd with the parenting or other layout
related things in the attached screenshot ?
The problem being that the grid showing the measurements does
not properly fit itself into the panel it is shown on:
- it bleeds into the sizer/widgets below it
- it doesn't effect a vertical scrollbar despite being "too large" vertically
- it doesn't sufficiently expand horizontally to fully fit the columns
(the last column is slightly clipped which probably makes it show
a horizontal scrollbar)
- it does not expand into the available horizontal space
Here are relevant parts of the grid class that's used:
wxgMeasurementsPnl.py (6.3 KB)
···
#---------------------------
class cMeasurementsGrid(wx.grid.Grid):
def __init__(self, *args, **kwargs):
wx.grid.Grid.__init__(self, *args, **kwargs)
self.__patient = None
self.__panel_to_show = None
self.__show_by_panel = False
self.__cell_data = {}
self.__row_label_data = []
self.__prev_row = None
self.__prev_col = None
self.__prev_label_row = None
self.__date_format = str((_('lab_grid_date_format::%Y\n%b %d')).lstrip('lab_grid_date_format::'))
self.__init_ui()
self.__register_events()
def __init_ui(self):
self.CreateGrid(0, 1)
self.EnableEditing(0)
self.EnableDragGridSize(1)
self.SetMinSize(wx.DefaultSize)
# row labels
self.SetRowLabelSize(wx.grid.GRID_AUTOSIZE) # starting with 2.8.8
self.SetRowLabelAlignment(horiz = wx.ALIGN_LEFT, vert = wx.ALIGN_CENTRE)
font = self.GetLabelFont()
font.SetWeight(wx.FONTWEIGHT_LIGHT)
self.SetLabelFont(font)
# add link to left upper corner
url = u'http://www.laborlexikon.de'
self.__WIN_corner = self.GetGridCornerLabelWindow() # a wx.Window instance
LNK_lab = wx.lib.hyperlink.HyperLinkCtrl (
self.__WIN_corner,
-1,
label = _('Tests'),
style = wx.HL_DEFAULT_STYLE # wx.TE_READONLY|wx.TE_CENTRE| wx.NO_BORDER |
)
LNK_lab.SetURL(url)
LNK_lab.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_BACKGROUND))
SZR_inner = wx.BoxSizer(wx.HORIZONTAL)
SZR_inner.Add((20, 20), 1, wx.EXPAND, 0) # spacer
SZR_inner.Add(LNK_lab, 0, wx.ALIGN_CENTER_VERTICAL, 0) #wx.ALIGN_CENTER wx.EXPAND
SZR_inner.Add((20, 20), 1, wx.EXPAND, 0) # spacer
SZR_corner = wx.BoxSizer(wx.VERTICAL)
SZR_corner.Add((20, 20), 1, wx.EXPAND, 0) # spacer
SZR_corner.AddWindow(SZR_inner, 0, wx.EXPAND) # inner sizer with centered hyperlink
SZR_corner.Add((20, 20), 1, wx.EXPAND, 0) # spacer
self.__WIN_corner.SetSizer(SZR_corner)
SZR_corner.Fit(self.__WIN_corner)
#---------------------------
I also attach the wxGlade generated code that is used
to populate the panel representing the notebook page.
Thanks a lot,
Karsten
--
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346