My problem is that I cannot see how to customise an editor for grid
cells that will give me the same screen display for the string-being-
edited as I can get from a custom renderer. I have tried looking at
Robin's code for a custom editor which appeared in an email from
the 4th. November, but still do not understand how to solve my
problem. Thanks in advance if anyone can help.
I am trying to use a Grid in order to edit and check logic proofs. To
do this, using a syntax that is standard for teaching logic here, I
need to be able to use certain symbols (the Universal Quantifier for
example which appears in the Symbol Face Code, and which, of
course, also has a Unicode representation).
I have found that I can render text in grid cells, with a custom
renderer based on the demo, such that character-by-character, I
can change fonts, which enables me to use different face codes for
the characters (this all done with a modified definition of Draw for
wxPyGridCellRenderer). This enables me to have certain
characters appearing as logic synmbols (thus Double Quote can
become the Universal Quantifier using the "Symbol" face code. At
the same time alphanumeric characters can still appear as
standard latin characters (whereas if I kept using the "Symbol" face
code they would be in Greek). What I do not see, is how to
customise the editor to get my symbols to show as the text is
edited. Show for wxPyGridCellEditor only has an argument that
allows specification of font and colours for the whole cell, and I
cannot see what would allow me to modify fonts and colours on a
character-by-character basis.
Here is a code fragment for Draw in my renderer, which illustrates
what I do:
for ch in text:
dc.SetTextForeground(wxRED)
if ch=='''\"''':
dc.SetFont(wxFont(10, wxROMAN, wxNORMAL,
wxBOLD,false,"Symbol"))
else:
dc.SetFont(wxFont(10, wxSWISS, wxNORMAL,
wxBOLD))
dc.DrawText(ch, x, y)
w, h = dc.GetTextExtent(ch)
x = x + w
if x > rect.right - 5:
break
Yours,
Roger Young
Roger Young,
Philosophy Department,
University of Dundee
r.a.young@dundee.ac.uk
tel 01382 344539
···
_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/wxpython-users