[Tkinter-discuss] New Full Tkinter document editor widget -- suggestions, comments, etc.
longorh at npt.nuwc.navy.mil
Tue Mar 25 15:47:02 CET 2008
I just wanted to clarify that the purpose of this widget is to simplify the
presentation and generation of styled text to/from multiple formats. In
particular I'm interested in targeting HTML, but I believe the widget will
facilitate most formats. With the new applyStyleAttribute method, it is now
possible to easily handle most of the basic styling tags, such as , and
<U>. Similarly, from a call to dump() it's very simple to generate HTML
code. tagon and tagoff entries in the dump should correspond directly to
opening and closing HTML tags.
My second alpha release will contain user-defined styles, which set multiple
style attributes. This will facilitate presentation and generation of tags
like <code> (those that modify several style attributes at once.).
Once this is completed and fairly well debugged, I plan to work on various
ways to present and generate some of the structured HTML objects. In
particular, I'm interested in lists and tables.
Ron Provost-2 wrote:
> I've posted a demo (http://tkinter.unpy.net/wiki/StyledEditor). This demo
> creates a widget with full "styled editing" capabilities; sort of a
> mini-word processor. It runs "as is" on my WinXP machine with Python 2.5.
> The demo allows styling of any selected text via toolbars; just select the
> text, then select the styling. Also included are buttons to save and
> retrieve all content and styling information (works for the small tests
> tried myself, not guaranteed bug-free).
> The actual widget wraps the Text widget to give greater freedom in the
> assignment of any single styling attribute to any region. This differs
> the Text widget itself in that the Text widget does not allow you to
> individually assign a family, size, weight or slant with tag_config().
> is, for example, you can't simply apply 'bold' to some region of text.
> This demo was written quite quickly (I pounded it out over the weekend) so
> I'm sure it's full of bugs. Also in my desire to get something working
> quickly its API doesn't really work like a normal widget, so I guess this
> serves as more of a proof of concept than full-blown widget but the basic
> functionality is there. I'm presenting it here because I thought maybe
> others might have thoughts on how to improve it.
> API Notes:
> applyStyleAttribute( index1, index2, attributeName, attributeValue )
> This method is is frontend to the business. attributeName and
> attributeValue may be any option accpeted by tag_config() of the Text
> along with appropriate value. There are also some ''new'' options:
> - 'family', attributeValue is a font family name
> - 'size', attributeValue is a font point size
> - 'weight', attributeValue is one of: 'normal', 'bold'
> - 'bold', attributeValue is a boolean (alternative to using 'weight')
> - 'slant', attributeValue is one of: 'roman', 'italic'
> - 'italic', attributeValue is boolean (alternative to using 'slant')
> Several previously existing options have some new values:
> 'spacing1', 'spacing2' and 'spacing3' may take 'None', 'Half Line', 'One
> Line' or 'Two Lines' in addition to any of the values acceptable by
> 'offset' may take 'normal', 'superscript' or 'subscript' in addition to
> value acceptable by tag_config.
> Please download and try-out my demo
> (http://tkinter.unpy.net/wiki/StyledEditor). I'm anxious for suggestions
> and comments.
> Ron Longo
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
View this message in context: http://www.nabble.com/New-Full-Tkinter-document-editor-widget----suggestions%2C-comments%2C-etc.-tp16266693p16275292.html
Sent from the Python - tkinter-discuss mailing list archive at Nabble.com.
More information about the Tkinter-discuss