# Graphics in irb

**URL:** <https://www.ruby-forum.com/t/graphics-in-irb/53612>\
**Category:** Ruby\
**Created:** [February 11, 2006, 2:03pm UTC](https://www.ruby-forum.com/t/graphics-in-irb/53612 "2006-02-11T14:03:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew\_McGuinness](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3e96dc/32.png) [@Andrew\_McGuinness](https://www.ruby-forum.com/u/Andrew_McGuinness)\
**Post date:** [February 11, 2006, 2:03pm UTC](https://www.ruby-forum.com/t/graphics-in-irb/53612/1 "2006-02-11T14:03:36Z")

</div>

I’m starting to teach my 7-year-old programming in Ruby, but unlike  
Scheme or Python or Logo, there doesn’t seem to be a graphical  
interactive environment, such as DrScheme or Livewires.

It should be easy to create one, and I’ve made a start using Tk and irb.  
I’ve come across what looks like an ommission in irb:

The IRB::Irb constructor takes optional “input\_method” and  
“output\_method” parameters. I’ve created an InputMethod subclass that  
reads commands from a GUI window, which works, but the output method is  
ignored - it’s passed to the IRB::Context object, but never used.

It looks like something like the following is missing:

module IRB  
class Context  
def output( str )  
@output\_method.print( str )  
end  
end

class Irb  
def printf( \*args )  
@context.output( sprintf( \*args ) )  
end  
end  
end

By doing that, I can then direct irb’s output to my GUI object.

How should this get fixed in irb?

---

<div class="post-metadata">

**Author:** ![Andrew\_McGuinness](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3e96dc/32.png) [@Andrew\_McGuinness](https://www.ruby-forum.com/u/Andrew_McGuinness)\
**Post date:** [February 11, 2006, 7:35pm UTC](https://www.ruby-forum.com/t/graphics-in-irb/53612/2 "2006-02-11T19:35:50Z")

</div>

On 2/11/06, Andrew McGuinness [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ## ignored - it’s passed to the IRB::Context object, but never used. class Irb
> 
> Andrew McGuinness

I think you can look here for a solution  
[http://onestepback.org/packages/rubyturtles/](http://onestepback.org/packages/rubyturtles/)

Prasad
