Server IP : 103.119.228.120 / Your IP : 18.221.12.61 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 : |
# tree.tcl -- # # This demonstration script creates a toplevel window containing a Ttk # tree widget. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require Tk package require Ttk set w .tree catch {destroy $w} toplevel $w wm title $w "Directory Browser" wm iconname $w "tree" positionWindow $w ## Explanatory text ttk::label $w.msg -font $font -wraplength 4i -justify left -anchor n -padding {10 2 10 6} -text "Ttk is the new Tk themed widget set. One of the widgets it includes is a tree widget, which allows the user to browse a hierarchical data-set such as a filesystem. The tree widget not only allows for the tree part itself, but it also supports an arbitrary number of additional columns which can show additional data (in this case, the size of the files found in your filesystem). You can also change the width of the columns by dragging the boundary between them." pack $w.msg -fill x ## See Code / Dismiss pack [addSeeDismiss $w.seeDismiss $w] -side bottom -fill x ## Code to populate the roots of the tree (can be more than one on Windows) proc populateRoots {tree} { foreach dir [lsort -dictionary [file volumes]] { populateTree $tree [$tree insert {} end -text $dir \ -values [list $dir directory]] } } ## Code to populate a node of the tree proc populateTree {tree node} { if {[$tree set $node type] ne "directory"} { return } set path [$tree set $node fullpath] $tree delete [$tree children $node] foreach f [lsort -dictionary [glob -nocomplain -dir $path *]] { set type [file type $f] set id [$tree insert $node end -text [file tail $f] \ -values [list $f $type]] if {$type eq "directory"} { ## Make it so that this node is openable $tree insert $id 0 -text dummy ;# a dummy $tree item $id -text [file tail $f]/ } elseif {$type eq "file"} { set size [file size $f] ## Format the file size nicely if {$size >= 1024*1024*1024} { set size [format %.1f\ GB [expr {$size/1024/1024/1024.}]] } elseif {$size >= 1024*1024} { set size [format %.1f\ MB [expr {$size/1024/1024.}]] } elseif {$size >= 1024} { set size [format %.1f\ kB [expr {$size/1024.}]] } else { append size " bytes" } $tree set $id size $size } } # Stop this code from rerunning on the current node $tree set $node type processedDirectory } ## Create the tree and set it up ttk::treeview $w.tree -columns {fullpath type size} -displaycolumns {size} \ -yscroll "$w.vsb set" -xscroll "$w.hsb set" if {[tk windowingsystem] ne "aqua"} { ttk::scrollbar $w.vsb -orient vertical -command "$w.tree yview" ttk::scrollbar $w.hsb -orient horizontal -command "$w.tree xview" } else { scrollbar $w.vsb -orient vertical -command "$w.tree yview" scrollbar $w.hsb -orient horizontal -command "$w.tree xview" } $w.tree heading \#0 -text "Directory Structure" $w.tree heading size -text "File Size" $w.tree column size -stretch 0 -width 70 populateRoots $w.tree bind $w.tree <<TreeviewOpen>> {populateTree %W [%W focus]} ## Arrange the tree and its scrollbars in the toplevel lower [ttk::frame $w.dummy] pack $w.dummy -fill both -expand 1 grid $w.tree $w.vsb -sticky nsew -in $w.dummy grid $w.hsb -sticky nsew -in $w.dummy grid columnconfigure $w.dummy 0 -weight 1 grid rowconfigure $w.dummy 0 -weight 1