RichTextTable example

Can anyone show an example with wx.richtext.RichTextTable? There is only documentation, but no example available with RichTextTable.

Its usage is shown in the C++ sample. Not ideal for a Python user, but if you know a little C/C++ it shouldn’t be too hard to translate.

I’ve been playing around with it a little. Here’s a code snippet
that might at least get you started:

rows = 2
cols = 3
table = self.txtCtrl.WriteTable(rows, cols)
for col in range(cols):
for row in range(rows):
cell = table.GetCell(row, col)
# Change formatting in self.txtAttr
  self.SetTxtStyle(fontSize = 10, fontItalic = True, parLeftIndent = 10, parRightIndent = 10, parSpacingAfter =25)
cell.AddParagraph("This is the cell at Row {0}, Column {1}\n".format(row, col))

Note that self.SetTxtStyle is a convenience method I use for
formatting text in the RichTextCtrl that’s not part of the control
itself. It modifies a global self.txtAttr that runs throughout my
app. I find it easier to use, and it avoids some issues I had
with the RTC years ago. You can see what that method does,
though, if you look at the code for the RichTextCtrl demo in the
wxPython Docs and Demos download.

Hope that helps,