![]() ![]() Also, the documentation is quite sparse at the moment, which turns programming into a guessing game at times.ĭespite that, Ruby Shoes' animation and graphical abilities make it very handy for quickly prototyping applications with graphical elements. It is a bit early in it's development process and, as Why The Lucky Stiff says, some concepts of the toolkit are prone to change. ![]() In conclusion: Ruby Shoes is definitely worth a look, if only because it uses different concepts than other plain GUI toolkits. This is an easy way of associating events with handler functions, unlike the Publish/Subscribe model that is otherwise used for GUI interaction In the same way, everything under the objects/ directory is routed to the object method, with everything after the slash passed to the handler method as argument. the root of the application is routed to the index method. Lines 18 through 21 show how URLs are routed to handler functions. URL routing for assigning handler functions to URL patterns.This code shows some concepts that Ruby Shoes uses. Clicking on a link shows the instances of the classes:Ģ def self.find_objects(name, from=0, to=10)ĥ # get the class object from its name stringħ ObjectSpace::each_object( name_const ):" + obj.join(',')Ĥ2 flow :width => 380, :margin_left => 10 doĥ7 = Util::find_objects("Class", 0, 200)ĥ8 Shoes.app :width => 640, :height => 700, :title => "Classes" The following sample is a very simple Class/Object browser: it lists all classes loaded as paginated link list. Setting up links to the GUI is easy, as is handling them in the code. Ruby Shoes brings URLs and links to the GUI and makes actions simple to implement. This shouldn't be surprising, as Ruby Shoes originated with the Hackety project, aimed at making programming easy for programming beginners.Īnother aspect, as can be seen from the sample, is the use of Web concepts. The animation and graphics capabilities lower the barrier for graphical applications such as visualization or creation of teaching materials. Oval(hor - radius, vert-radius, radius*2.0) Here another example that also shows how to track motions of the mouse cursor: Ruby Shoes supports the creation of graphics with primitives such as lines or ovals and paths, and operations for transformation, scaling or rotation. The numeric parameter is the frame rate for the animation, and the given block is executed update the animation at the given rate. The animate call handles animation in a very succinct way. Here a code snippet for a simple animation showing a counter: ![]() The influence of the languages for visualization can be seen by looking at some of the samples included with the Ruby Shoes. The latter languages are specialized for tasks such as visualization. The Ruby Shoes Readme names toolkits such as HyperCard or languages such as Processing or NodeBox as influences. Ruby Shoes is actually written in C and uses Ruby native extensions to allow interaction with Ruby code. Currently MacOS X, Windows and GTK versions are available. The number of GUI controls it supports is limited by design, and the ones that do exist use OS GUI specific components. Why's toolkit Ruby Shoes, is a GUI toolkit built on GTK technologies Cairo (drawing) and Pango (for text). ![]() Ruby Shoes is a creation of Why The Lucky Stiff, author of Why's (Poignant) Guide to Ruby and prolific programmer of libraries such as HPricot (HTML Parser), the web framework Camping and many others. Ruby Shoes is a GUI toolkit with a slightly different focus. These libraries use different approaches for building and arranging GUI components. There are many old style bindings to GUI toolkits such as Qt or GTK, or embedded DSLs or APIs based on JRuby such as these three new ways of building GUIs with Swing. The experimentation in the Ruby GUI space continues. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |