in reply to Tk Formatting

For many widgets, $widget->height($widget->reqheight) will work. (and also s/height/width/g).

Assuming that you're using some form of a Tk::Text for the @ChapterText, I'd suggest using the textbox's height and width (which set the widget size based on the font used) and then resize the MainWindow based on $text->reqheight and $text-reqwidth.