background preloader

Shoes! The easiest little GUI toolkit, for Ruby.

Shoes! The easiest little GUI toolkit, for Ruby.
Related:  Ruby

10 Free E-Books on Ruby for Beginners Ruby may have lost some of its shine in recent months to JavaScript and Node.js, but it's still one of the most popular programming languages out there, and it's still growing. There are a large number of beginner's Ruby resources out there, and the material is diverse. Here are a few places to get started. Hackety Hack This isn't actually an e-book, but an interactive tutorial. It runs on Windows, OSX or Linux. It was created by _why the lucky stiff, something of a legend in the Ruby scene. _why's (Poignant Guide) to Ruby Also by _why, this illustrated guide to Ruby may be totally engrossing to some readers and too outlandish for others. _why deleted the book when he exited the Internet, but there are many mirrors. Mr. Another quirky beginner's guide is Mr. Programming Ruby: The Pragmatic Programmers' Guide Learn to Program Learn to Program by Chris Pine is a popular beginner's book on programming that centers using Ruby as its starter language. 4 More Check out the for more.

Introduction © Jean-Pierre ANGHEL - 2004 FXRuby Par l’exemple Table des matières. 2 Introduction. 4 Chapitre 1. 6 Bref historique de Ruby. 6 Bref historique de Fox. 6 Où trouver Ruby ?. Avec quel éditeur de texte ?. Quelles connaissances faut-il avoir ?. Avantages divers. 7 Présentation des composants visuels. 7 Présentation des aménageurs d'espace. 8 Chapitre 2. 9 Les fenêtres et tout ce qui va avec. 9 Un peu de Ruby. 10 Particularités de FXRuby. 11 Chapitre 3. 12 Le bouton simple. 12 Un peu de ruby (1) : 15 Les commentaires et substitutions. 15 Exemple général sur les boutons. 16 Particularités de FXRuby : 20 Les cadres et séparateurs. 22 Les boîtes à grouper. 22 Les cases à cocher. 23 Les boutons-radio. 23 Les boutons-bascule. 23 Les boutons avec flèches incorporées. 23 Les bulles d'aide. 24 La barre de statut 24 Un peu de Ruby (2) : 24 Les variables. 24 Les opérateurs. 25 Les méthodes. 26 Chapitre 4. 28 Les canevas. 28 Un peu de Ruby. 32 Les blocs. 32 Les itérateurs. 33 Les boucles. 33 Les expressions conditionnelles. 34 Notes. 167 p1

Gosu : une bibliothèque pour faire des jeux avec Ruby Toutes les fonctions et les classes sont contenues dans le module Gosu. Lorsqu'un paramètre de type Gosu::Color est demandé, on peut mettre à la place un entier de la forme : 0xAARRGGBB (ici en hexadécimal). A = Code alpha (255 : aucune transparence, 0 : transparence totale) R = Code pour le rouge G = Code pour le vert B = Code pour le bleu On peut utiliser une couleur lors du dessin pour modifier la couleur originale de l'image. Pour les paramètres de mode pour les fonctions de dessins, les valeurs possibles sont : :default :additive Profondeur d'un dessin : lorsque deux dessins occupent la même place, il faut déterminer lequel écrase l'autre : pour cela certaines fonctions permettent de spécifier une profondeur : le dessin de profondeur la plus grande sera dessinée sur tous les autres. Paramètre facultatif : tous paramètres ayant une valeur par défaut (=valeur) peut être ignoré lors de l'appel : il aura alors sa valeur par défaut. Les angles dans Gosu:

Ruby QuickRef Table of Contents Language General Tips These are tips I’ve given over and over and over and over… Use 2 space indent, no tabs. See for more. General Syntax Rules Comments start with a pound/sharp (#) character and go to EOL. Reserved Words alias and BEGIN begin break case class def defined? Types Basic types are numbers, strings, ranges, regexen, symbols, arrays, and hashes. Numbers 1231_234123.451.2e-30xffff 0b01011 0377 ? Strings In all of the %() cases below, you may use any matching characters or any single character for delimiters. %[], %!! 'no interpolation'"#{interpolation}, and backslashes\n"%q(no interpolation)%Q(interpolation and backslashes)%(interpolation and backslashes)`echo command interpretation with interpolation and backslashes`%x(echo command interpretation with interpolation and backslashes) Backslashes: Here Docs: Encodings: Waaaay too much to cover here. Symbols Internalized String. Ranges 1..101...10'a'..' Regexen "r"

Ruby/TK Guide Introduction: The standard graphical user interface (GUI) for Ruby is Tk. Tk started out as the GUI for the Tcl scripting language developed by John Ousterhout. Tk has the unique distinction of being the only cross-platform GUI. Tk runs on Windows, Mac, and Linux and provides a native look-and-feel on each operating system. The basic component of a Tk-based application is called a widget. Tk applications follow a widget hierarchy where any number of widgets may be placed within another widget, and those widgets within another widget, ad infinitum. Most Tk-based applications follow the same cycle: create the widgets, place them in the interface, and finally, bind the events associated with each widget to a method.There are three geometry managers; place, grid and pack that are responsible for controlling the size and location of each of the widgets in the interface. Installation: The Ruby Tk bindings are distributed with Ruby but Tk is a separate installation. Simple Tk Application:

Ruby and SciTE Daniela Robles (Guest) on 2012-11-11 20:58 Hi all, Ruby no longer comes together with SciTE, so I had to download the SciTE text editor separately. However, I find that Ruby and ScITE do not work together. The command line in Ruby won't run or find any programs that I create with the text editor. How do I get them to work together? Carlo E. on 2012-11-11 21:11 Subject: Ruby and SciTE Date: Mon 12 Nov 12 04:58:09AM +0900 Quoting Daniela Robles (daniela.robles15@gmail.com): > ... on 2012-11-12 00:32 Am Mon, 12 Nov 2012 04:58:09 +0900 schrieb Daniela Robles <daniela.robles15@gmail.com>: > Hi all, Hi Daniela, > Ruby no longer comes together with SciTE, so I had to download the> SciTE text editor separately. Please log in before posting.

File (Ruby 2.2.0) absolute_path(file_name [, dir_string] ) → abs_file_name click to toggle source Converts a pathname to an absolute pathname. Relative paths are referenced from the current working directory of the process unless dir_string is given, in which case it will be used as the starting point. File.absolute_path("~oracle/bin") VALUE rb_file_s_absolute_path(int argc, const VALUE *argv) { VALUE fname, dname; if (argc == 1) { return rb_file_absolute_path(argv[0], Qnil); } rb_scan_args(argc, argv, "11", &fname, &dname); return rb_file_absolute_path(fname, dname); } atime(file_name) → time click to toggle source Returns the last access time for the named file as a Time object). file_name can be an IO object. File.atime("testfile") static VALUE rb_file_s_atime(VALUE klass, VALUE fname) { struct stat st; if (rb_stat(fname, &st) < 0) { FilePathValue(fname); rb_sys_fail_path(fname); } return stat_atime(&st); } basename(file_name [, suffix] ) → base_name click to toggle source File.birthtime("testfile") blockdev?

RubyInstaller for Windows IO binread(name, [length [, offset]] ) → string click to toggle source Opens the file, optionally seeks to the given offset, then returns length bytes (defaulting to the rest of the file). binread ensures the file is closed before returning. The open mode would be “rb:ASCII-8BIT”. IO.binread("testfile") IO.binread("testfile", 20) IO.binread("testfile", 20, 10) binwrite(name, string, [offset] ) => fixnum click to toggle source Opens the file, optionally seeks to the given offset, writes string then returns the length written. binwrite ensures the file is closed before returning. IO.binwrite("testfile", "0123456789", 20) IO.binwrite("testfile", "0123456789") static VALUE rb_io_s_binwrite(int argc, VALUE *argv, VALUE io) { return io_s_write(argc, argv, 1); } copy_stream(src, dst) click to toggle source copy_stream(src, dst, copy_length) copy_stream(src, dst, copy_length, src_offset) ::copy_stream copies src to dst. src and dst is either a filename or an IO. Synonym for IO.new. produces: Parameters¶ ↑ fd

Introduction to Ruby Ruby is a powerful, flexible programming language you can use in web/Internet development, to process text, to create games, and as part of the popular Ruby on Rails web framework. Ruby is: High-level, meaning reading and writing Ruby is really easy—it looks a lot like regular English!Interpreted, meaning you don't need a compiler to write and run Ruby. You can write it here at Codecademy or even on your own computer (many are shipped with the Ruby interpreter built in—we'll get to the interpreter later in this lesson).Object-oriented, meaning it allows users to manipulate data structures called objects in order to build and execute programs. This course assumes no previous knowledge of Ruby in particular or programming/computer science in general.

Graphical User Interfaces: Installing Tk The Tk GUI toolkit was originally written for the TCL scripting language, but has since been adopted by many other languages including Ruby. Though it's not the most modern of toolkits, it is free and cross-platform and is a good choice for simpler GUI applications. However, before you can begin writing GUI programs, you first have to install the Tk library and the Ruby "bindings." A binding is the Ruby code used to interface with the Tk library itself. Without bindings, a scripting language cannot access native libraries such as Tk. How you install Tk will vary depending on your operating system. Installing Tk on Windows There are numerous ways to install Tk on Windows, but the easiest is to install the ActiveTCL scripting language from Active State. continue reading below our video Loaded: 0% Progress: 0% While TCL is a completely different scripting language than Ruby, it's made by the same people who make Tk and the two projects are closely linked. Installing Tk on Ubuntu Linux Testing Tk #!

Object Oriented Ruby Ruby is pure object-oriented language and everything appears to Ruby as an object. Every value in Ruby is an object, even the most primitive things: strings, numbers and even true and false. Even a class itself is an object that is an instance of the Class class. This chapter will take you through all the major functionalities related to Object Oriented Ruby. A class is used to specify the form of an object and it combines data representation and methods for manipulating that data into one neat package. The data and methods within a class are called members of the class. Ruby class definition: When you define a class, you define a blueprint for a data type. A class definition starts with the keyword class followed by the class name and is delimited with an end. class Box code end The name must begin with a capital letter and by convention names that contain more than one word are run together with each word capitalized and no separating characters (CamelCase). Define ruby objects: #! #! #! #! #!

WxRubyWiki: WxRuby wxRuby is an open source GUI toolkit for the [Ruby] programming language. It allows native-looking desktop applications to be written for Windows, OS X, Linux GTK and other platforms using only Ruby. It's based on the cross-platform [wxWidgets] C++ GUI framework. Why wxRuby? wxRuby offers a combination of features that no other GUI library in Ruby can match: More about wxRuby features - why choose it as a GUI toolkit for Ruby? Development Status The current wxRuby version is [2.0.1], released on 9 Sep 2009. Developing with wxRuby StyleGuide - general advice on programming style and strategies for wxRuby wxRuby Tutorial - guides to using different features of wxRuby FAQS - frequently asked questions about wxRuby Real-life wxRuby applications and [online code samples] - where to find examples to learn from WxSugar - wxSugar; additional tools and syntax for wxRuby, from the core dev team [[RubyOnWindows]] - a good intro How to use this site Latest News Older news

Ruby Classes and Objects Ruby is a perfect Object Oriented Programming Language. The features of the object-oriented programming language include: Data Encapsulation: Data Abstraction:Polymorphism:Inheritance: These features have been discussed in Object Oriented Ruby. An object-oriented program involves classes and objects. Take the example of any vehicle. A vehicle can also have certain functions, such as halting, driving, and speeding. A class Vehicle can be defined as: Class Vehicle{ Number no_of_wheels Number horsepower Characters type_of_tank Number Capacity Function speeding { } Function driving { } Function halting { }} By assigning different values to these data members, you can form several instances of the class Vehicle. Defining a Class in Ruby: To implement object-oriented programming by using Ruby, you need to first learn how to create objects and classes in Ruby. A class in Ruby always starts with the keyword class followed by the name of the class. class Customerend Variables in a Ruby Class: Example: #!

Related: