I figured out how to do what I wanted. It works much faster than I thought it would. I subclassed the ImageRenderer and overrode getValueBitmap. The only change was to pass the current grid row height to the strToBmp.
def getValueBitmap(self, grid, row, col): """ Take the local _imageDict and update it with the grid's dict, if any. Use that to look up the image to use for the given value. If not found, then see if that image is a 'standard' dabo image. If none of these return a value, return None, which won't draw anything. """ val = grid._Table.GetValue(row, col, convertNoneToString=False) try: imgLookup = grid.imageDict[val] except (AttributeError, KeyError): # Either no 'imageDict' attribute for the grid, or there is such an # att and the key is not found. Try standard images. # I'm passing in the height of the grid row and the strToBmp will scale the width to it. ret = dabo.ui.strToBmp(val, height=grid.RowHeight) return ret ---------- Forwarded message ---------- From: Matt Jackson <matt5...@gmail.com> Date: Fri, Feb 24, 2012 at 10:41 AM Subject: Resize an image in grid To: Dabo Users list <dabo-users@leafe.com> I'm displaying images in a grid control. The images are stored as files and there is a field that contains the fully qualified path to the image file (jpg). I set the custom renderer for the column to the ImageRenderer. It works great and really fast. The only issue I have is the images are really large so it displays only a portion of the image. Is there a way to set the ImageRenderer to fit the image instead of clipping it? I'm working in an Appwizard generated application and I'm modifying the grid used to browse the query results. Here's the code I'm using to display the image. This is the 5th column in the grid. self.addColumn(dabo.ui.dColumn(self, DataField="ImageFullPath", Caption=biz.getColCaption("ImageFullPath"), Sortable=True, Searchable=True, Editable=False)) colImage = self.Columns[4] colImage.CustomRendererClass = dabo.ui.gridRenderers.ImageRenderer I tried creating a child of the ImageRenderer class code is below. When I used it there was no difference. class CustImageRenderer(dabo.ui.gridRenderers.ImageRenderer): def GetBestSize(self, grid, attr, dc, row, col): return wx.Size(10, 10) Thanks, Matt -- Matt Jackson -- Matt Jackson --- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html --- _______________________________________________ Post Messages to: Dabo-users@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/CAKsSVxkAhmsMFO+s7Lm-Hru9+4b1KfwC93oKbVbeS=Gm=rf...@mail.gmail.com