Jimmy
Jimmy

Reputation: 145

How to set error message window size?

How to show complete message in the pop-up error window? sample:enter image description here

error "convergency_check_start should be larger than 3."

Upvotes: 0

Views: 338

Answers (1)

Sergei Golovan
Sergei Golovan

Reputation: 611

You won't get the full error message if you'll increase the error window size. The message is truncated deliberately. You could look into bgerror.tcl inside your Tk library folder just to find that the error message lines are truncated at 45 characters.

What you could do is override the ::tk::dialog::error::bgerror procedure. And since totally rewriting it is too tedious, I'd suggest to patch it as follows:

#!/usr/bin/wish

set eproc ::tk::dialog::error::bgerror
auto_load $eproc
proc $eproc [info args $eproc] [string map {45 150} [info body $eproc]]

after idle {
    error "Quick brown fox jumped over the lazy dog. Quick brown fox jumped over the lazy dog."
}

This code replaces 45 by 150 in the body of ::tk::dialog::error::bgerror and shows the whole error message in the window. Without [string map ...] only about a half of the message is displayed imemdiately (you can still see all the mesage with a stack trace after clicking the Details >> button).

Upvotes: 2

Related Questions