librelist archives

« back to archive

Creating a console window

Creating a console window

From:
Timothy Barnes
Date:
2012-02-14 @ 18:51
My problem:

I created an shoes application (green_shoes) that call many other ruby
programs that I have previously written. The previous programs were all
console based programs using "puts" and "gets" for input/output. I would
like the shoes app to catch the input and output so that I don't have to
keep going to the console and answer the problems.

Since my program is large I wrote a sample application with a button that
calls puts and gets. I can send the "puts" to an "edit_box" but I can't
control the "gets". Any help with this is appreciated.

Here is code:
https://gist.github.com/1829056

Timothy (barnes7td)

Fwd: Creating a console window

From:
Timothy Barnes
Date:
2012-02-14 @ 20:28
---------- Forwarded message ----------
From: Timothy Barnes <barnes7td@gmail.com>
Date: Tue, Feb 14, 2012 at 1:51 PM
Subject: Creating a console window
To: shoes@librelist.com


My problem:

I created an shoes application (green_shoes) that call many other ruby
programs that I have previously written. The previous programs were all
console based programs using "puts" and "gets" for input/output. I would
like the shoes app to catch the input and output so that I don't have to
keep going to the console and answer the problems.

Since my program is large I wrote a sample application with a button that
calls puts and gets. I can send the "puts" to an "edit_box" but I can't
control the "gets". Any help with this is appreciated.

Here is code:
https://gist.github.com/1829056

Timothy (barnes7td)

Re: [shoes] Creating a console window

From:
Cecil Coupe
Date:
2012-02-15 @ 05:15
Hi Tim,

  You will need to become very familiar with pipes and threads in Ruby.
I don't know how much this will help you but my isp-ping logger might
give you some ideas. http://www.mvmanila.com/public/isp.rb

--Cecil

On Tue, 2012-02-14 at 13:51 -0500, Timothy Barnes wrote:
> My problem:
> 
> 
> I created an shoes application (green_shoes) that call many other ruby
> programs that I have previously written. The previous programs were
> all console based programs using "puts" and "gets" for input/output. I
> would like the shoes app to catch the input and output so that I don't
> have to keep going to the console and answer the problems. 
> 
> 
> Since my program is large I wrote a sample application with a button
> that calls puts and gets. I can send the "puts" to an "edit_box" but I
> can't control the "gets". Any help with this is appreciated. 
> 
> 
> Here is code:
> https://gist.github.com/1829056
> 
> 
> Timothy (barnes7td)

Re: [shoes] Creating a console window

From:
ashbb
Date:
2012-02-15 @ 12:09
Hi Timothy,

Thank you for sharing a problem.
We can learn a lot. :)

> I created an shoes application (green_shoes) that call many other
> ruby programs that I have previously written.
Wow, cool!

> The previous programs were all console based programs using "puts"
> and "gets" for input/output. I would like the shoes app to catch
> the input and output so that I don't have to keep going to the
> console and answer the problems.
Aha, I understand what you want to do.

> I can't control the "gets".
Because your previous programs have to wait user input,...
Right? ;-)

Well then, how about using `ask` like this?

https://gist.github.com/1835292

ashbb

ps.
This post may also help you.
http://vgoff.posterous.com/three-viewers-for-ruby-warrior