• .text dump - is there an inverse and size to fit

    From et99@21:1/5 to All on Thu Dec 21 19:08:39 2023
    I found Arjen's little word processor on the wiki.

    https://wiki.tcl-lang.org/page/Editing+with+different+fonts

    The store command uses the "dump" command for a text widget outputting triples.

    .text dump 1.0 end


    Question 1:


    I want to take that list, save, and then restore to an empty text widget. Is there an inverse?

    Or do I have to go down the triples and generate a command that does what they indicate. It's not coming to me just what those commands might be for each of text, mark, tagon, tagoff. Does anyone have a snippet that does that?


    Question 2:


    Once I have this text restored, is there an easy way to make the text widget resize to just fit the text. Note that the text won't necessarily be a single fixed size font. And I want it to be a border-less window. Sorta like a tooltip.

    I've done some internet searches on this and the answers are all in python, which I don't speak.





    Thanks

    et

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From et99@21:1/5 to greg on Fri Dec 22 01:03:12 2023
    On 12/21/2023 11:21 PM, greg wrote:
    package require Tk
    catch { destroy .note errorswindow }
    set w [ toplevel .note ]
    wm withdraw .
    tk appname "note"
    wm title $w "note"
    wm overrideredirect $::w 1
    wm geometry $w "+190+190"

    set content "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et"

    text $w.note -wrap word -height 10 -width 20
    button $w.btn -text Exit -command exit
    pack $w.note $w.btn
    $w.note insert end $content

    Again, many thanks, now to combine the two pieces :)

    et

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From et99@21:1/5 to greg on Fri Dec 22 00:42:26 2023
    On 12/21/2023 10:02 PM, greg wrote:
    https://wiki.tcl-lang.org/page/Serializing+a+text+widget

    https://wiki.tcl-lang.org/page/ttd

    Outstanding! Thanks so much for the links.

    et

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)