#!/usr/local/bin/wish package require Tk proc connect_to_irc {} { set irc [socket "localhost" 6667] puts $irc "NICK TclTkCli" puts $irc "JOIN #tcl" puts $irc "PRIVMSG #tcl: Hi all :)" gets $irc data while {1} { .txt insert end "$data" gets $irc data } } frame .frm -relief groove button .irc -text "Connect to #tcl" -command "connect_to_irc" frame .textarea text .txt -width 30 -height 10 -yscrollcommand ".srl_y set" scrollbar .srl_y -command ".txt yview" -orient v pack .frm pack .irc -in .frm pack .txt -in .textarea grid .txt -in .textarea -row 1 -column 1 grid .srl_y -in .textarea -row 1 -column 2 -sticky ns pack .textarea