Nihongo (Japanese)

Ruby/Tk

Now I seldom uses Tcl/Tk. Ruby/Tk is interesting, useful and powerful!

Class

tkgetfile.rb

[Screen shot (1147 bytes)]

In tkgetfile.rb, there defined three classes; two of them are TkGetopenfile and TkGetsavefile which are wrappers of Tk commands tk_getOpenFile and tk_getSaveFile, respectively, and the other is TkGetfile class which is a super class of TkGetopenfile and TkGetsavefile. Like TkDialog class defined in tkdialog.rb, you can get a file name for open and save easily by TkGetopenfile and TkGetsavefile.

You may know the detailed usage of these classes when you read tkgetfile.rb :-). If you want to know the meanings of options, please read "man pages" of tk_getOpenFile.

When I made these classes, I didn't know that there were Tk.getOpenFile and Tk.getSaveFile in tk.rb (^^;. These methods require "Tcl list" as file patterns, however, my classes understand "Ruby array".

tkchoosecolor.rb

[Screen shot (835 bytes)]

TkChoosecolor class which is a wrapper of a Tk command tk_chooseColor is defined. Like a TkGetOpenfile class mentioned above, I did not know Tk.chooseColor when I made this class :-).

It would be better for a "Color chooser" script to handle not only RGB, but HSB as a Tk demo script tcolor distributed with Tk.

tkpopup.rb

[Screen Shot (1246 bytes)]

TkPopup class which is a wrapper of a Tk command tk_popup is defined. You can post a popup menu easily by specifying a TkMenu object.

tkmessagebox.rb

[Screen Shot (2287	bytes)]

TkMessagebox class which is a wrapper of a Tk command tk_messageBox is defined. Some kinds of dialog boxes are defined alreadly, and it is easier to use them than TkDialog.

Application

moc.rb

[Screen shot (1183 bytes)]

This is "MOuse Cursor viewer", where you can see the names and shapes of a mouse cursor defined (?) in X. The names of a mouse cursor are written on buttons (to tell the truth, these are raised labels, though). When you put a mouse cursor on a button, the shape of a cursor change.

Before using moc.rb, please specify the locations of Ruby interpreter in 1st line and cursorfont.h in 10th line.



[Rabbit Mark] Feel free to mail me

sato.mshr@gmail.com