Unfortunately, you can't do that is my understanding of the text widget. Here's the code for creating the text area and modifying the text in the widget, after creating the base canvas:
my $status_text_scrollbar = $logging_grid->new_ttk__scrollbar();
my $status_text = $logging_grid->new_tk__text();
$status_text->configure(
-width => 80,
-height => 10,
-yscrollcommand => [$status_text_scrollbar, "set"],
-state => "disabled",
);
$status_text_scrollbar->configure(
-command => [$status_text, "yview"],
-orient => "vertical",
);
update_tkx('Update the text in the box, please');
sub update_tkx {
my $status_text_string = $_[0];
# text control has to be enabled to write to it.
$status_text->configure(-state => "normal");
$status_text->insert("end", $status_text_string);
$status_text->see("end");
# Don't want the user editing this...
$status_text->configure(-state => "disabled");
Tkx::update();
}
Ideally, it would be nice to be able to call
update_tkx() when the l4p event fires. I don't know how to do that, and feed it data from an appender. Otherwise, I'll have to call the sub with the data in the code every time I log something. Not undoable, but it doesn't really help me simplify the logging as much as I'd like.