회사에서 필요로 인해 잠시 만들어 보았습니다. 4개의 웹 페이지를 동시에 디스플레이해 줍니다.
참고로 올립니다. 귀찮아서 코드는 다듬지 않았습니다. -_-
set url1 "http://empas.com"
set url2 "http://yahoo.com"
set url3 "http://google.com"
set url4 "http://naver.com"
package require optcl
package require TclCurl
package require tile
package require https
package require BWidget
wm withdraw .
BWidget::place . 800 600 center
wm deiconify .
wm title . "Four Web Browser"
# --------------
proc statusChange {id status} {
}
proc progressChange {id min max} {
if { $min == 0 } {
if { [winfo exist $::pbframe($id).pb] } {
destroy $::pbframe($id).pb
unset ::pbframe($id).pb
update idletasks
}
} {
if { ![info exist ::pbframe($id).pb] } {
set ::pbframe($id).pb [ttk::progressbar $::pbframe($id).pb \
-max $max]
pack $::pbframe($id).pb -side left -fill x -expand 1
}
$::pbframe($id).pb configure -value $min
}
}
proc Refresh {id} {
$id Refresh
}
# --------------
#pack [ttk::button .b -text "Exit" -command exit ] -side top -anchor w
set topframe [ttk::frame .topframe]
pack $topframe -side top -fill both -expand true
set frame [ttk::labelframe $topframe.frame1 -text "Web"]
pack $frame -side left -fill both -expand true
set refresh [ttk::button $frame.refresh \
-compound left \
-text "Refresh" \
-image [Bitmap::get refresh] \
-style Toolbutton]
pack $refresh -side top -anchor w
set iexplorer1 [optcl::new -window $frame.iexplorer1 Shell.Explorer.2]
pack $frame.iexplorer1 -side top -fill both -expand true
$refresh configure -command [list Refresh $iexplorer1]
set statusframe [ttk::frame $frame.statusframe]
pack $statusframe -side top -fill x
set ::pbframe($iexplorer1) [ttk::frame $statusframe.pbframe($iexplorer1)]
pack $::pbframe($iexplorer1) -side left -fill x -expand 1
$iexplorer1 Navigate $url1
optcl::bind $iexplorer1 StatusTextChange statusChange;
optcl::bind $iexplorer1 ProgressChange progressChange;
# --------------
set frame [ttk::labelframe $topframe.frame2 -text "Web"]
pack $frame -side left -fill both -expand true
set refresh [ttk::button $frame.refresh \
-compound left \
-text "Refresh" \
-image [Bitmap::get refresh] \
-style Toolbutton]
pack $refresh -side top -anchor w
set iexplorer2 [optcl::new -window $frame.iexplorer2 Shell.Explorer.2]
pack $frame.iexplorer2 -fill both -expand true
$refresh configure -command [list Refresh $iexplorer2]
set statusframe [ttk::frame $frame.statusframe]
pack $statusframe -side top -fill x
set ::pbframe($iexplorer2) [ttk::frame $statusframe.pbframe($iexplorer2)]
pack $::pbframe($iexplorer2) -side left -fill x -expand 1
$iexplorer2 Navigate $url2
optcl::bind $iexplorer2 StatusTextChange statusChange;
optcl::bind $iexplorer2 ProgressChange progressChange;
set bottomframe [ttk::frame .bottomframe]
pack $bottomframe -side top -fill both -expand true
set frame [ttk::labelframe $bottomframe.frame1 -text "Web"]
pack $frame -side left -fill both -expand true
set refresh [ttk::button $frame.refresh \
-compound left \
-text "Refresh" \
-image [Bitmap::get refresh] \
-style Toolbutton]
pack $refresh -side top -anchor w
set iexplorer1 [optcl::new -window $frame.iexplorer1 Shell.Explorer.2]
pack $frame.iexplorer1 -side top -fill both -expand true
$refresh configure -command [list Refresh $iexplorer1]
set statusframe [ttk::frame $frame.statusframe]
pack $statusframe -side top -fill x
set ::pbframe($iexplorer1) [ttk::frame $statusframe.pbframe($iexplorer1)]
pack $::pbframe($iexplorer1) -side left -fill x -expand 1
$iexplorer1 Navigate $url3
optcl::bind $iexplorer1 StatusTextChange statusChange;
optcl::bind $iexplorer1 ProgressChange progressChange;
# --------------
set frame [ttk::labelframe $bottomframe.frame2 -text "Web"]
pack $frame -side left -fill both -expand true
set refresh [ttk::button $frame.refresh \
-compound left \
-text "Refresh" \
-image [Bitmap::get refresh] \
-style Toolbutton]
pack $refresh -side top -anchor w
set iexplorer2 [optcl::new -window $frame.iexplorer2 Shell.Explorer.2]
pack $frame.iexplorer2 -fill both -expand true
$refresh configure -command [list Refresh $iexplorer2]
set statusframe [ttk::frame $frame.statusframe]
pack $statusframe -side top -fill x
set ::pbframe($iexplorer2) [ttk::frame $statusframe.pbframe($iexplorer2)]
pack $::pbframe($iexplorer2) -side left -fill x -expand 1
$iexplorer2 Navigate $url4
optcl::bind $iexplorer2 StatusTextChange statusChange;
optcl::bind $iexplorer2 ProgressChange progressChange;
'Tcl & Tk > 팁 (Tip)' 카테고리의 다른 글
trace 커맨드를 이용한 심플 디버거 제작 (0) | 2025.03.12 |
---|---|
피아노 코드 도우미 v0.925 (0) | 2025.03.12 |
시간에 따라 변화하는 결과를 plotting하기 (0) | 2025.03.12 |
읽어온 데이터를 BLT를 이용해서 2차원 그래프 그리기 (0) | 2025.03.12 |
Gnuplot + Tcl/Tk (0) | 2025.03.12 |