Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
delayed evaluation for tk callbacks?

Posted by that_guy (that_guy), 8 August 2003
Hello.  I remember seeing a really useful post by Graham describing common mistakes made when dealing with delayed evaluation for Tk callbacks/ widget variables. I can't seem to find this post, so if anyone has  a link to it, I'd greatly appreciate it.  The question behind all this: is it possible to have the -textvariable of a widget be set to a delayed evaluation of a command? In this case that command would be a database query. In other words something like :
label .lbl -textvariable "{mysqlsel db "select ip_addr from hosts where host='$::host'}"    I'm not entirely sure how Tk's tracing works- but I'm guessing that  my question makes no sense because it
would cause the label to make countless database queries... and that instead I need to make sure that all methods modifying the database reflect their actions in a variable exposed to the widget.

Posted by admin (Graham Ellis), 10 August 2003
Graham answering briefly - I'm away from my office for a few days so I'll struggle to find it just like you.

Couple of tips:

1. You *can* do a -command as well as a -textvariable, so you can change a variable and run a proc when an interactive widget is changed.

2.  Note update idletasks if you want you display updated even if you haven't finished handling all events.

There's a history of all posts on our web site; if you go to http://www.wellho.net and enter some words that were uses in the search box (half way down left hand side) it will search many places including forum archives.   May help you find the article



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2014: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho