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
 
20.9.2014 - We have just updated our course layouts and descriptions and added our 2015 schedule.

Fonctionnement Perl/Tkto

Posted by dje76 (dje76), 5 September 2004

Hello,

i have a new little problem:
how can i have a real time ProgressBar fonction with 0.01 seconds progress when i hold a key?
i see that Tk module concider a refresh of all windows only when i moove the mouse (or if i hit a key... or an event occurs with the window's select)... i hope there is a flag who can turn the module to automaticly refresh the windows each 5 miliseconds... or every time is possible... but i don't have the information....

PS: my code is write, but it has this problem: i must manualy moove the mouse for run to programm on....  

thanks a lot for your help.



Posted by admin (Graham Ellis), 5 September 2004
Have you looked at alarm signals ... ah, but they use 1 second granularity which doesn't sound like it's enough. The Camel book suggests the syscall function to access setitimer if your system supports it, or Timer::HiRes. I've not used these last two methods myself, but hope the pointer helps.

Posted by dje76 (dje76), 6 September 2004
Yes, i used Time::HiRes with setitimer ITIMER_REAL for $SIG{ALRM} signal with 0.01 second of interval delay (and 1 second before start, because i have a thread's runing in parrallel). And to see my real time holding space key (pressing and releasing) i used Tk:rogressBar.... but the problem is that i must moved the mouse in the main Windows for see the result of timing on the progress ber... and i try to send automaticly an event (with eventGenerate(...) in the sub-function link with the SIG signal) to refresh the windows in real time without success... that's why i see that Tk run a boucle from initialy main Window defined to mainloop() only when an event (the mouse's moved... a key's pressed) occurs.
I think that it must be possible to make something for refresh the windows without manually action on an input device.... but how to do this?



Posted by dje76 (dje76), 9 September 2004
Hello,

My problem is resolved with :  $widget->repeat(ms=>callback);

where ms is a tempo in millisecond and callback is a sub-routing calling...


PS: with less than 10 ms, the prog seems to be too slow...



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