Hi everyone. I've been working on a simple rich text component for a project I've been working on using a gtk.TextView, and while I have something that's usable (in a very loose sense of the word =), there are a couple of problems I'm having that I can't figure out how to solve. This is what I have so far...
http://pastebin.com/m6d3eb0b9 (The toggle buttons and text view are part of a glade file) For one, if there isn't text selected and the bold, italic, or underline button is pressed, I tried to apply the tag (buffer.apply_tag_by_name) by using the cursor's position as the start and end gtk.TextIter, although it seems to do nothing, as any text I type after I apply the tag is still in the same font as before. Also, when I have the cursor at the last character of a section of text with an applied style and I type more text, it doesn't keep the formatting like word processors do. (If text in underscores is bold) _This is bold te_ (But if I keep typing, the formatting isn't kept) _This is bold te_xt (It should be like this) _This is bold text_ I found a rich text demo application in Pygtk while I was searching for a solution (http://www.mail-archive.com/[email protected]/msg10283.html), but that one has the same limitation as mine. (Tags are not applied to text added directly after a section with the tag applied) And lastly, when the cursor is at the beginning of a block of text with an applied style, the gtk.TextIter at the cursor position says that the tag for the style is applied, but when I type it shows up in the default font ( '|' is the cursor) |_ere is bold text_ (iter.get_tags() has the bold tag, but when I type something...) h_ere is bold text_ (The tag is not applied) Why does it say that the bold tag is applied at the cursor if it doesn't apply the tag to text typed at that location? I think I might be missing something fundamental about how tags work... >_< I'm sorry if any of this was unclear. If anyone could point me in the right direction I would be grateful. =) ~Dennis _______________________________________________ pygtk mailing list [email protected] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
