Tcl & Tk/팁 (Tip)

Windows의 트레이 영역에 Notification 팝업 띄우기

티클러 2025. 3. 26. 10:31

twapi를 이용한 예제입니다. 이 예제를 응용하면 Winico 같이 프로그램을 트레이로 넣을 수 있습니다.

set auto_path [linsert $auto_path 0 ./twapi-bin]
package require twapi

set ico [twapi::load_icon_from_system information -width 16 -height 16]

set ::systray_test_events {}
proc systray_test_handler {args} {
        lappend ::systray_test_events $args

}

set id [twapi::systemtray addicon $ico [namespace current]::systray_test_handler]

set balloon "TWAPI Test balloon. Do not click until asked to do so."
set balloontitle "TWAPI Test"

twapi::systemtray modifyicon $id -balloon $balloon -balloontitle $balloontitle -balloonicon warning

after 3000 set ::wait_over 1
vwait ::wait_over

twapi::systemtray removeicon $id

puts $::systray_test_events