<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://php.apsique.com" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>Php y otras yerbas - Ruby con Glade - Comentarios</title>
 <link>http://php.apsique.com/contenido/ruby_con_glade</link>
 <description>Comentarios para &quot;Ruby con Glade&quot;</description>
 <language>es</language>
<item>
 <title>pregunta?</title>
 <link>http://php.apsique.com/contenido/ruby_con_glade#comment-14120</link>
 <description>&lt;p&gt;me baje el glade para windows, ya lo instale y cree una interfaz basica coloque un label y un boton, los guarde, mi pregunta o preguntas son estas:&lt;/p&gt;
&lt;p&gt;como utilizo perl o php para la programacion de la interface?, apenas estoy entrando en esto, solo habia programado en visual basic, poco en c++, y otro poco en php, que tal esta ruby, de antemano gracias ...&lt;/p&gt;
</description>
 <pubDate>Wed, 19 Oct 2005 08:06:01 -0700</pubDate>
 <dc:creator>gustavo</dc:creator>
 <guid isPermaLink="false">comment 14120 at http://php.apsique.com</guid>
</item>
<item>
 <title>La verdad es que suelo leer todo en inglés (por algo casi todos</title>
 <link>http://php.apsique.com/contenido/ruby_con_glade#comment-152</link>
 <description>&lt;p&gt;La verdad es que suelo leer todo en inglés (por algo casi todos los links están en ese idioma). Por eso mesmo, no sé que tutorial hay bueno en castellano.&lt;br /&gt;
Te recomiendo encarecidamente que leas el &#039;manual oficial&#039; de Ruby, llamado Programming Ruby. Lo puedes leer en línea en &lt;a href=&#039;http://www.rubycentral.com/book/&#039;&gt;http://www.rubycentral.com/book/&lt;/a&gt;&lt;/p&gt;
</description>
 <pubDate>Tue, 24 Aug 2004 21:00:11 -0700</pubDate>
 <dc:creator>Claudex</dc:creator>
 <guid isPermaLink="false">comment 152 at http://php.apsique.com</guid>
</item>
<item>
 <title>Hola.
Hey men, me has hecho entrar ganas de aprender ruby.</title>
 <link>http://php.apsique.com/contenido/ruby_con_glade#comment-151</link>
 <description>&lt;p&gt;Hola.&lt;br /&gt;
Hey men, me has hecho entrar ganas de aprender ruby.&lt;br /&gt;
Conoces algun tutorial en español de ruby (me manejo bien con el ingles, pero me canso mas rapido xD).&lt;/p&gt;
&lt;p&gt;Dew.&lt;br /&gt;
PS: Agregado a mis favoritos ;)&lt;/p&gt;
</description>
 <pubDate>Tue, 24 Aug 2004 06:31:20 -0700</pubDate>
 <dc:creator>Tuxiradical</dc:creator>
 <guid isPermaLink="false">comment 151 at http://php.apsique.com</guid>
</item>
<item>
 <title>Ruby con Glade</title>
 <link>http://php.apsique.com/contenido/ruby_con_glade</link>
 <description>&lt;p&gt;No soy muy amigo de programar interfaces gráficas, lo confieso. Con VB logré algo interesante, el no famoso &lt;a href=&#039;http://dkm3.sourceforge.net/&#039;&gt;Drum kit manager III&lt;/a&gt; para crear drumkits en &lt;a href=&#039;http://www.buzzmachines.com/&#039;&gt;Buzz&lt;/a&gt; (el mejor tracker de la historia), pero quedé tan traumado con las llamadas a DLL, que preferí abstenerme.&lt;/p&gt;
&lt;p&gt;Ya entrando en el mundo de PHP, obviamente me entraron las ganas de programar alguna interface gráfica con &lt;a href=&#039;http://gtk.php.net/&#039;&gt;PHP-GTK&lt;/a&gt;, pero quedó en buenas intenciones.&lt;/p&gt;
&lt;p&gt;Con &lt;a href=&#039;http://www.ruby-lang.org/&#039;&gt;Ruby&lt;/a&gt; la cosa ha cambiado. Es tan bonito el lenguaje, que vale la pena intentar hacer cosas extrañas con él. Si bien he hecho mis pinitos con &lt;a href=&#039;http://httpd.chello.nl/k.vangelder/ruby/learntk/&#039;&gt;Ruby-Tk&lt;/a&gt;, la mayoría de los comentarios apuntan es que hay mejores librerías.&lt;/p&gt;
&lt;p&gt;En las reuniones de la CWC, Hyoga (un periodista linuxero a matar) salió con &#039;Por qué no cooperas con Gnome?&#039;. Hmmm... La &lt;a href=&#039;http://www.gtk.org/&#039;&gt;GTK&lt;/a&gt; es bastante conocida y recomendada, Ruby tiene una &lt;a href=&#039;http://ruby-gnome2.sourceforge.jp/&#039;&gt;biblioteca de integración a GTK2&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Dicho y hecho. Aquí van las instrucciones de trabajo (supongo que de tanto hablar de Ruby ya lo tienen instalado, no?):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Como trabajo en Windows (terrible, no?),  baje los paquetes descritos en &lt;a href=&#039;http://ruby-gnome2.sourceforge.jp/hiki.cgi?Install+Guide+for+Windows&#039;&gt;Install Guide for Windows for Ruby-Gnome&lt;/a&gt;. El único problema que tuve fue que la versión de &lt;a href=&#039;http://www.gnu.org/software/libiconv/&#039;&gt;iconv&lt;/a&gt; que tenía en el %WIN%/S ystem32 estaba desactualizada, así que la borre y puse la que venía en la distribución de los binarios de GTK&lt;/li&gt;
&lt;li&gt;Ya que el Glade venía en el paquete de desarrollo de GTK, creamos una interface básica, la cual llame rubyglade.glade&lt;/li&gt;
&lt;li&gt;Desde Ruby, las siguientes instrucciones son necesarias para proveer una mínima funcionalidad
&lt;div class=&#039;code&#039;&gt;&lt;div class=&quot;hl-main&quot;&gt;&lt;ol class=&quot;hl-main&quot;&gt;&lt;li&gt;&amp;nbsp;&lt;span class=&quot;hl-reserved&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt; &lt;/span&gt;&lt;span class=&quot;hl-quotes&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;libglade2&lt;/span&gt;&lt;span class=&quot;hl-quotes&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;hl-identifier&quot;&gt;Gtk&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;hl-identifier&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;hl-reserved&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt; &lt;/span&gt;&lt;span class=&quot;hl-identifier&quot;&gt;GUI&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;hl-reserved&quot;&gt;attr_accessor&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt; :&lt;/span&gt;&lt;span class=&quot;hl-identifier&quot;&gt;wTree&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;hl-reserved&quot;&gt;def&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt; &lt;/span&gt;&lt;span class=&quot;hl-identifier&quot;&gt;initialize&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;    &lt;/span&gt;&lt;span class=&quot;hl-var&quot;&gt;@wTree&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt; = &lt;/span&gt;&lt;span class=&quot;hl-identifier&quot;&gt;GladeXML&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;hl-identifier&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;hl-brackets&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-quotes&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;gladetest/gladetest.glade&lt;/span&gt;&lt;span class=&quot;hl-quotes&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;hl-brackets&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt; {|&lt;/span&gt;&lt;span class=&quot;hl-identifier&quot;&gt;handler&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;|&lt;/li&gt;
&lt;li&gt;&amp;nbsp;    &lt;/span&gt;&lt;span class=&quot;hl-identifier&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;hl-brackets&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl-identifier&quot;&gt;handler&lt;/span&gt;&lt;span class=&quot;hl-brackets&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;}&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;hl-reserved&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;hl-reserved&quot;&gt;def&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt; &lt;/span&gt;&lt;span class=&quot;hl-identifier&quot;&gt;on_boton_clicked&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;    &lt;/span&gt;&lt;span class=&quot;hl-identifier&quot;&gt;puts&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt; &lt;/span&gt;&lt;span class=&quot;hl-quotes&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;clickeado&lt;/span&gt;&lt;span class=&quot;hl-quotes&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;hl-reserved&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;hl-reserved&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;hl-identifier&quot;&gt;GUI&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;hl-identifier&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;hl-identifier&quot;&gt;puts&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt; &lt;/span&gt;&lt;span class=&quot;hl-quotes&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-string&quot;&gt;inicializado&lt;/span&gt;&lt;span class=&quot;hl-quotes&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;hl-identifier&quot;&gt;Gtk&lt;/span&gt;&lt;span class=&quot;hl-code&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;hl-identifier&quot;&gt;main&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;
Como pueden ver, es bastante sencillo. &lt;/li&gt;
&lt;li&gt;Tienen que incluir el paquete &lt;b&gt;libglade2&lt;/b&gt; al inicio del script, el cual carga a &#039;gtk2&#039;. &lt;/li&gt;
&lt;li&gt;Después, inicializo el GTK con &lt;b&gt;GTK.init&lt;/b&gt;.&lt;/li&gt;
&lt;li&gt;Para cargar el glade, ocupo el método GladeXML.new y paso en un bloque lo que debe hacer el programa con cada señal. En este caso, hago lo más simple, que es enviar la señal al método de la clase &lt;b&gt;GUI&lt;/b&gt; con el mismo nombre. 
&lt;/li&gt;
&lt;li&gt;Para finalizar, instancio la GUI y echo a andar el GTK con &lt;b&gt;Gtk.main&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Ven, no es nada del otro mundo. Puede que algunos no hayan entendido nada, pero uno nunca sabe...&lt;/p&gt;</description>
 <comments>http://php.apsique.com/contenido/ruby_con_glade#comments</comments>
 <category domain="http://php.apsique.com/lenguajes/ruby">Ruby</category>
 <category domain="http://php.apsique.com/categoria/busquedas_comunes/glade_gui">glade gui</category>
 <pubDate>Sun, 22 Aug 2004 09:35:56 -0700</pubDate>
 <dc:creator>admin</dc:creator>
 <guid isPermaLink="false">75 at http://php.apsique.com</guid>
</item>
</channel>
</rss>
