Graphics in irb

A

Andrew McGuinness

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?
 
G

G.Durga Prasad

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?

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

Prasad
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top