Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can't update contents of text widget

2 views
Skip to first unread message

Will Duquette

unread,
Dec 21, 2009, 1:13:02 PM12/21/09
to
I'm running into very odd text widget behavior. I've got a routine
that deletes the contents of a text widget and inserts new text. Most
of the time it works fine; but in one particular case, neither the
"delete" nor the
"insert" appear to have had any effect. Here's the snippet of code;
$script is the text to insert, and $tscript is the text widget.

puts "Inserting <$script> into $tscript"
$tscript delete 1.0 end
puts "A: <[$tscript get 1.0 end]>"
$tscript insert 1.0 $script
puts "B: <[$tscript get 1.0 end]>"
$tscript see 1.0
$tscript yview moveto 0.0

The first "puts" indicates that the text to be inserted is what I
think it is. The second and third "puts" calls show that the contents
of the text widget is unchanged after the "insert" and "delete" calls.

As I say, this happens only sometimes. It's easily repeatable; but
I've been unable to find any obvious reason why the behavior differs
in the different cases. More to the point, I can't see why the
"delete" and "insert" should ever be ignored.

Anybody have any ideas?

Will Duquette

unread,
Dec 21, 2009, 1:14:55 PM12/21/09
to

Never mind; nothing to see here, move along. These aren't the badgers
you're looking for.

Jeff Godfrey

unread,
Dec 21, 2009, 3:17:56 PM12/21/09
to
Will Duquette wrote:
> On Dec 21, 10:13 am, Will Duquette <w...@wjduquette.com> wrote:
>> I'm running into very odd text widget behavior. I've got a routine
>> that deletes the contents of a text widget and inserts new text. Most
>> of the time it works fine; but in one particular case, neither the
>> "delete" nor the
>> "insert" appear to have had any effect.
>> Anybody have any ideas?
>
> Never mind; nothing to see here, move along. These aren't the badgers
> you're looking for.

I'd guess the widget was (sometimes) disabled? ;^)

Jeff

Will Duquette

unread,
Dec 21, 2009, 4:48:12 PM12/21/09
to

*Blush*

Yes, that was it. The text widget contains a script; as the app was
originally designed, the text widget was disabled while the script was
executing. Later, I changed it so that the script's execution
terminates if the user interacts with the text widget in any way,
e.g., by clicking on it. That removed the need for disabling the text
widget. And all of this is more or less ancient history; I'd almost
forgotten about it.

0 new messages