New Full Tkinter document editor widget -- suggestions, comments, etc.

Discussion in 'Python' started by Ron Provost, Mar 25, 2008.

  1. Ron Provost

    Ron Provost Guest

    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 I've
    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 from
    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(). That
    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 widget
    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
    tag_config().

    'offset' may take 'normal', 'superscript' or 'subscript' in addition to any
    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
    Ron Provost, Mar 25, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stylus Studio
    Replies:
    0
    Views:
    640
    Stylus Studio
    Aug 3, 2004
  2. Jeff Epler
    Replies:
    0
    Views:
    497
    Jeff Epler
    Aug 20, 2004
  3. Frederic Rentsch
    Replies:
    0
    Views:
    224
    Frederic Rentsch
    Jul 8, 2012
  4. Terry Reedy
    Replies:
    15
    Views:
    615
    Frederic Rentsch
    Jul 16, 2012
  5. Frederic Rentsch
    Replies:
    0
    Views:
    419
    Frederic Rentsch
    Jul 9, 2012
Loading...

Share This Page