私はtclノートブックを作成しました。ファイルが大きすぎると2つのタブがあり、スクロールできません。ここで自分のコードを共有する。 このコードを実行するには、2つのファイル(Warning.txtとError.txt)が必要です。このコードを実行する前に、同じディレクトリに配置してください。 Error.txtとWarning.txtという2つのファイルを作成してください。 いくつかのコンテンツを約10,000行にします。ノートブックでスクロールダウンできません
#!/usr/bin/wish -f
#
package require Tk
proc noteb {} {
global rundir logfile
frame .lpo
pack .lpo -side top -fill both -expand true
#cd $rundir
set ft [exec grep -c Warning ./Warning.txt]
puts $ft
set ert [exec grep -c Error ./Error.txt]
puts $ert
pack [frame .fa] -fill both -side top
pack [ttk::notebook .fa.nb] -fill both
set gt "Errors"
set bt "Warnings"
set delim ":"
set rt [concat [string trim $bt][string trim $delim][string trim $ft]]
set dt [concat [string trim $gt][string trim $delim][string trim $ert]]
if {$ft > 0} {
.fa.nb add [frame .fa.nb.f1] -text $rt
} else {
.fa.nb add [frame .fa.nb.f1] -text "Warnings"
}
pack [frame .fa.nb.f1.f11] -side top -fill both -expand true
pack [text .fa.nb.f1.f11.t1 -bg LightYellow -borderwidth 2 -width 80 -height 6 -relief raised -setgrid true ] -side left -fill both -expand true
scrollbar .fa.nb.f1.f11.scroll -command {.fa.nb.f1.f11.t1 yview}
pack .fa.nb.f1.f11.scroll -side right -fill y
set fp1 [open Warning.txt r]
set v [read $fp1]
.fa.nb.f1.f11.t1 insert 1.0 $v
close $fp1
if {$ert > 0} {
.fa.nb add [frame .fa.nb.f2] -text $dt
} else {
.fa.nb add [frame .fa.nb.f2] -text "Errors"
}
pack [frame .fa.nb.f2.f11] -side top -fill both -expand true
pack [text .fa.nb.f2.f11.t1 -bg LightYellow -borderwidth 2 -width 80 -height 6 -relief raised -setgrid true ] -side left -fill both -expand true
scrollbar .fa.nb.f2.f11.scroll -command {.fa.nb.f2.f11.t1 yview}
pack .fa.nb.f2.f11.scroll -side right -fill y
set fp [open Error.txt r]
set c [read $fp]
.fa.nb.f2.f11.t1 insert 1.0 $c
close $fp
}
button .mn -text summary -command {noteb}
pack .mn -side left