Text flow

Basic idea is to emulate text flow for text widget through multilayout widgets display and some kind of geometry management for text using tags.

package require Tk
package require Img

grid [frame .f] -column 0 -row 0 -sticky nswe
grid columnconfigure . 0 -weight 1; grid rowconfigure . 0 -weight 1
grid columnconfigure .f 0 -weight 1; grid rowconfigure .f 0 -weight 1

set img [image create photo -data {iVBORw0KGgoAAAANSUhEUgAAACAAAAAgAQMAAABJtOi3AAAAAXNSR0IArs4c6QAAAARnQU1BAACx
jwv8YQUAAAAGUExURQAAAP///6XZn90AAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAPSURBVBjTY/gP
BAyDlwAA2ul/gcqaQMAAAAAASUVORK5CYII=}]

grid [text .f.t -height 10 -width 20] -column 0 -row 0 -sticky nswe
grid [button .f.b -image $img] -column 0 -row 0 -sticky nw

set w [expr {[image width $img]+8}]
set h [expr {[image height $img]+4}]

.f.t tag configure tag1 -lmargin1 $w -lmargin2 $w

.f.t insert end "qwertyuiopasdfghjklzxcvbnm1234567890qwertyuiopasdfghjklzxcvbnm1234567890qwertyuiopasdfghjklzxcvbnm1234567890qwertyuiopasdfghjklzxcvbnm1234567890"

update

bind .f.t <Key> {+mod}
bind .f.t <Configure> {+mod}

proc mod {} {
  .f.t tag add tag1 1.0 end
  .f.t mark set offset @[winfo width .f.t],$::h
  .f.t tag remove tag1 1.0 end
  .f.t tag add tag1 1.0 offset
}

mod