有一种方法可以使文本跨越网格小部件中的多行或多列。wxPython 演示中有一个名为 GridSimple.py 的示例。见第 64-67 行。他们是这样读的:
self.SetCellValue( 9, 1, "This default cell will overflow into neighboring cells, but not if you turn overflow off.");
self.SetCellSize(11, 1, 3, 3);
self.SetCellAlignment(11, 1, wx.ALIGN_CENTRE, wx.ALIGN_CENTRE);
self.SetCellValue(11, 1, "This cell is set to span 3 rows and 3 columns");
Run Code Online (Sandbox Code Playgroud)
注意:您不需要分号。我不知道他们为什么在这个例子中。