# IRB on a text widget of Ruby/Tk

**URL:** <https://www.ruby-forum.com/t/irb-on-a-text-widget-of-ruby-tk/75187>\
**Category:** Ruby\
**Created:** [November 8, 2006, 3:15am UTC](https://www.ruby-forum.com/t/irb-on-a-text-widget-of-ruby-tk/75187 "2006-11-08T03:15:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hidetoshi\_NAGAI](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/49beb7/32.png) [@Hidetoshi\_NAGAI](https://www.ruby-forum.com/u/Hidetoshi_NAGAI)\
**Post date:** [November 8, 2006, 3:15am UTC](https://www.ruby-forum.com/t/irb-on-a-text-widget-of-ruby-tk/75187/1 "2006-11-08T03:15:16Z")

</div>

Hi,

A sample tool of Ruby/Tk is available.  
It uses a text widget as a console I/O.  
If you have troubles about thread-switching on IRB  
(for example, IRB on a command-prompt of Windows),  
it may be able to help you.

Console I/O on Windows blocks Ruby’s thread-switching.  
That is, IRB cannot work with background threads on Windows.  
On the sample script, a text widget takes the place of a console  
without blocking thread-switching.  
That is similar to Tcl/Tk’s “wish” unless not calling shell commands.

If you may try it, please get two files from Ruby’s CVS tree.  
Those are “ext/tk/sample/irbtkw.rbw” and “ext/tk/sample/tktextio.rb”.  
“irbtkw.rbw” is the main script.

“tktextio.rb” is updated (it is a by-product of Ruby/TkORCA).  
Old one cannot work with “irbtkw.rbw”.

Probably, “irbtkw.rbw” will work on ruby-1.8.2 or later.
