Server IP : 103.119.228.120 / Your IP : 3.144.42.233 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/tk8.5/demos/ |
Upload File : |
# anilabel.tcl -- # # This demonstration script creates a toplevel window containing # several animated label widgets. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require Tk set w .anilabel catch {destroy $w} toplevel $w wm title $w "Animated Label Demonstration" wm iconname $w "anilabel" positionWindow $w label $w.msg -font $font -wraplength 4i -justify left -text "Four animated labels are displayed below; each of the labels on the left is animated by making the text message inside it appear to scroll, and the label on the right is animated by animating the image that it displays." pack $w.msg -side top ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x # Ensure that this this is an array array set animationCallbacks {} ## This callback is the core of how to do animation in Tcl/Tk; all ## animations work in basically the same way, with a procedure that ## uses the [after] command to reschedule itself at some point in the ## future. Of course, the details of how to update the state will vary ## according to what is being animated. proc RotateLabelText {w interval} { global animationCallbacks # Schedule the calling of this procedure again in the future set animationCallbacks($w) [after $interval RotateLabelText $w $interval] # We do marquee-like scrolling text by chopping characters off the # front of the text and sticking them on the end. set text [$w cget -text] set newText [string range $text 1 end][string index $text 0] $w configure -text $newText } ## A helper procedure to start the animation happening. proc animateLabelText {w text interval} { global animationCallbacks # Install the text into the widget $w configure -text $text # Schedule the start of the animation loop set animationCallbacks($w) [after $interval RotateLabelText $w $interval] # Make sure that the animation stops and is cleaned up after itself # when the animated label is destroyed. Note that at this point we # cannot manipulate the widget itself, as that has already died. bind $w <Destroy> { after cancel $animationCallbacks(%W) unset animationCallbacks(%W) } } ## Next, a similar pair of procedures to animate a GIF loaded into a ## photo image. proc SelectNextImageFrame {w interval} { global animationCallbacks set animationCallbacks($w) \ [after $interval SelectNextImageFrame $w $interval] set image [$w cget -image] # The easy way to animate a GIF! set idx -1 scan [$image cget -format] "GIF -index %d" idx if {[catch { # Note that we get an error if the index is out of range $image configure -format "GIF -index [incr idx]" }]} then { $image configure -format "GIF -index 0" } } proc animateLabelImage {w imageData interval} { global animationCallbacks # Create a multi-frame GIF from base-64-encoded data set image [image create photo -format GIF -data $imageData] # Install the image into the widget $w configure -image $image # Schedule the start of the animation loop set animationCallbacks($w) \ [after $interval SelectNextImageFrame $w $interval] # Make sure that the animation stops and is cleaned up after itself # when the animated label is destroyed. Note that at this point we # cannot manipulate the widget itself, as that has already died. # Also note that this script is in double-quotes; this is always OK # because image names are chosen automatically to be simple words. bind $w <Destroy> " after cancel \$animationCallbacks(%W) unset animationCallbacks(%W) rename $image {} " } # Make some widgets to contain the animations labelframe $w.left -text "Scrolling Texts" labelframe $w.right -text "GIF Image" pack $w.left $w.right -side left -padx 10 -pady 10 -expand yes # This method of scrolling text looks far better with a fixed-width font label $w.left.l1 -bd 4 -relief ridge -font fixedFont label $w.left.l2 -bd 4 -relief groove -font fixedFont label $w.left.l3 -bd 4 -relief flat -font fixedFont -width 18 pack $w.left.l1 $w.left.l2 $w.left.l3 -side top -expand yes -padx 10 -pady 10 -anchor w # Don't need to do very much with this label except turn off the border label $w.right.l -bd 0 pack $w.right.l -side top -expand yes -padx 10 -pady 10 # This is a base-64-encoded animated GIF file. set tclPoweredData { R0lGODlhKgBAAPQAAP//////zP//AP/MzP/Mmf/MAP+Zmf+ZZv+ZAMz//8zM zMyZmcyZZsxmZsxmAMwzAJnMzJmZzJmZmZlmmZlmZplmM5kzM2aZzGZmzGZm mWZmZmYzZmYzMzNmzDMzZgAzmSH+IE1hZGUgd2l0aCBHSU1QIGJ5IExARGVt YWlsbHkuY29tACH5BAVkAAEALAAAAAAqAEAAAAX+YCCOZEkyTKM2jOm66yPP dF03bx7YcuHIDkGBR7SZeIyhTID4FZ+4Es8nQyCe2EeUNJ0peY2s9mi7PhAM ngEAMGRbUpvzSxskLh1J+Hkg134OdDIDEB+GHxtYMEQMTjMGEYeGFoomezaC DZGSHFmLXTQKkh8eNQVpZ2afmDQGHaOYSoEyhhcklzVmMpuHnaZmDqiGJbg0 qFqvh6UNAwB7VA+OwydEjgujkgrPNhbTI8dFvNgEYcHcHx0lB1kX2IYeA2G6 NN0YfkXJ2BsAMuAzHB9c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kEBQoAAAAsFwA3AAcABQAABRGgIHzfY47j Q4qk+aHl+pZmCAAh+QQFCgAAACwbADcABwAFAAAFEaAgfs/zCV9qPiNJouo7 ll8IACH5BAUKAAAALB8ANwADAAUAAAUIoCB8o0iWZggAOw== } # Finally, set up the text scrolling animation animateLabelText $w.left.l1 "* Slow Animation *" 300 animateLabelText $w.left.l2 "* Fast Animation *" 80 animateLabelText $w.left.l3 "This is a longer scrolling text in a widget that will not show the whole message at once. " 150 animateLabelImage $w.right.l $tclPoweredData 100