From: GBanschbach@... Date: 2002-09-27T02:43:26+09:00 Subject: Ruby/Tk or mod_ruby or what ?? Dear All, I am writing to ask if someone among the Ruby user base can address an issue for me. I have begun to review Ruby after learning Java/Swing. I found Java to be good enough, but alot of code to get things done. It was not too painfull to learn. I read 3 books on Java / SWING and came away able to write basic apps with a GUI. I decided that I wanted something simpler, and cleaner to use. Something that I could also teach to others in my group [ mostly Bourne Shell scripters ]. Ruby is nice in the regard that it has a similar feel to shell scripting. Then I decided that since Tk was the default GUI for Ruby - sort of - and I remembered that I made some simple Tcl/Tk gui's before, I would use Tk again. Fine. But then I find out that the "interface" to Tk is very different........8-(. Then I start to look for docs on how to use it ..... you know, like a tutorial. I apologize in advance - a good tutorial is not a small project.... but the "tutorials" for Ruby/Tk are SAD. In fact, it would be more accurate to say that there aren't any. Maybe I should look at using some sort of ruby-to-web-browser interface... But to tell someone to "go read a Perl/Tk book" is doing Ruby a disservice. Some people will think "....I might as well use Perl then". Below is an approximation of what I think would be a help. If some of you more experienced with Ruby/Tk, maybe we can band together and put out the beginings of a tutorial......like what is below: [ This is a shade long but I want to show the kind of progression that is needed - please be patient ] One that ( like other GUI tutorials ) starts out by saying - Ok. Here is the root window. It does this. you put things in the root window. Here is a window with a button. Notice that when you run in Unix / X , that even though you copied the example WITH a title: #!/usr/bin/env ruby require 'tk' root = TkRoot.new() { title "Click the Button" } ... Tk.mainloop you will not see the title. Here is WHY: Yada Yada Yada. Here is the same code with x y z. A button usually has an action associated with it. Sometimes people will refer to the ACTION as a "CALLBACK." Here is how it works. Now let's talk about a script that has a text entry. When you enter a word into the text entry widget, it will convert the word to UPPER CASE. Here is the code..... WITH COMMENTS 8-). Notice that we put the widgets in a Frame. A frame is for ........ Now let's make it a 2 field Name - Phone number type of GUI - no lookup features - that is the Next version in Chapter 3. For now we will just add another text field and OK & Cancel buttons. [End] With Tk so prevalent, why isn't there something like this for Ruby. Every BOOK I have seen on Amazon got ONE chapter for Tk. Not even 15 pages. Most Tcl/Tk books have 50+ pages...... Ok, guys..... I'm done for now. I will help produce one if I can get the help I need to learn it.... no sense in just complaining.... 8-) Thanks, Greg