pythonwxpythonwxgrid

How to make text fit in cells in a wxPython grid?


Basically if I drag a cell I can size it to whatever size I want. Is there functionality in wxPython where cells expand automatically to fit the size of the text inside of them?


Solution

  • The Grid class has AutoSizeColumn/AutoSizeRow and AutoSizeColumns/AutoSizeRows methods that do a fairly good job of generically resizing rows or cols to be large enough for the contents of the row or col. They can be fairly expensive operations for large grids however, so they should be used with care.