2 require 'tkextlib/tile'
7 def initialize(host, room, username)
8 @ttsock = TTSock.new(host, room, username)
9 @ttcmd = TTCommander.new(@ttsock)
11 root = TkRoot.new() { title "Tablebottom" }
12 frame = Tk::Tile::Frame.new(root)
13 frame.grid(:sticky => "nsew")
14 TkGrid.columnconfigure root, 0, :weight => 1; TkGrid.rowconfigure root, 0, :weight => 1
16 @tkout = TkText.new(frame) { width 80; height 20;}
17 @tkout.grid( :row => 0, :column => 0, :sticky => "nsew")
18 TkGrid.columnconfigure frame, 0, :weight => 1; TkGrid.rowconfigure frame, 0, :weight => 1
20 @tkout.value = "Welcome to Tablebottom"
22 @tkin = Tk::Tile::Entry.new(frame) { width 80; }
23 @tkin.grid( :row => 1, :column => 0, :sticky => "nsew")
24 @invar = TkVariable.new("")
25 @tkin.textvariable(@invar)
27 root.bind("Return") { return_pressed(@invar.value); @invar.value = "" }
28 Tk.after(10) { do_network() }
31 def return_pressed(str)
32 @ttcmd.xyzzy_do_cmd(str)
36 @tkout.value = @tkout.value + str + "\n"
44 if msg and ((msg[0] == :lPresent) or (msg[0] == :mSay) or (msg[0] == :mOSay) or (msg[0] == :mCalc) or (msg[0] == :mRoll) or (msg[0] == :mFact) or (msg[0] == :mCheck))
48 Tk.after(10) { do_network() }
53 print "Host (None for Dare's system) : "
65 foo = TTTk.new(host, room, name)