wxRuby 1.9.4

The wxRuby team is pleased to invite you to try the latest version of
wxRuby, 1.9.4. [ http://wxruby.rubyforge.org ]

wxRuby is a cross-platform GUI toolkit for Ruby that provides native
widgets and application behaviour on the three major OSes. It’s easy to
install, fully featured, and liberally licensed, and comes with a wide
set of samples and complete ruby API documentation.

wxRuby 1.9.4 now supports almost all of the extensive wxWidgets API, and
is near production quality in terms of stability.

== MINIMAL EXAMPLE ==

require ‘wx’
Wx::App.run do
frame = Wx::Frame.new(nil, :title => “Minimal wxRuby App”)
button = Wx::Button.new(frame, :label => ‘Press me’)
evt_button(button) { puts ‘Clicked!’ }
frame.show
end

== WHAT’S NEW ==

Thanks to a number of contributors, this is a feature-packed release;
key changes include:

  • GraphicsContext, for high-quality, anti-aliased drawing and
    sophisticated image transforms
  • MediaCtrl, for playing and controlling sound and video files
  • GLCanvas, for drawing with OpenGL (requires ruby-opengl)
  • Drag’n’drop and Clipboard support for exchanging data within and
    between applications
  • Other minor additions, including SearchCtrl and GridTableBase
  • Support for universal binaries on OS X, and dynamic linking on Linux
  • Support for building with ruby 1.9 (although there are problems with
    ruby 1.9 bugs)
  • Many bugfixes and enhancements to existing classes
  • Additions to the samples and documentation

== INSTALLATION ==

As usual, the easiest way to get wxRuby is to install an all-in-one
precompiled rubygem:

gem install wxruby

Gems are currently available for Microsoft Windows, OS X 10.4/10.5
universal and Linux i686.

== THANKS ==

Thank you very much to everyone who helped with this release with
patches, bug reports and suggestions and discussions on the mailing
lists. Contributors to the 1.9.3 code include Sean L., Mario S.,
Albin Holmgren, Ryuichi Sakamoto and Dale Edmons

cheers
alex

Cool :wink:

Your message was last drop in my inner debate of wxruby vs fxruby :wink:

Only thing thou - do you have a gui builder?

On Jan 17, 2008, at 7:11 PM, Artūras Šlajus wrote:

Cool :wink:

Your message was last drop in my inner debate of wxruby vs fxruby :wink:

Only thing thou - do you have a gui builder?

There’s one that I’ve found, called FarPY, which was initially for
python wx, but it has support for ruby.

I hope there’s a better one, however!

Artūras Šlajus wrote:

Only thing thou - do you have a gui builder?

There are numerous free and commercial GUI builders for wxWidgets, and
they all output an XML format which can be used with wxRuby, wxPython
etc. I like DialogBlocks myself.

There’s also a tool for wxRuby which will generate all the Ruby code
needed to use these XML-based layouts. It’s a nice way to separate
design (widget layout) and program logic, as well as speeding
development.

http://wxruby.rubyforge.org/wiki/wiki.pl?Using_GUI_Designers
http://www.wxwidgets.org/wiki/index.php/Tools
http://wxruby.rubyforge.org/wiki/wiki.pl?UsingXRCise

alex

Alex F. wrote:

The wxRuby team is pleased to invite you to try the latest version of
wxRuby, 1.9.4. [ http://wxruby.rubyforge.org ]

I’d love to give this a go for my latest project, but there’s one thing
I need and it’s non-negotiable: a browser widget (HTML/CSS/Javascript).
Could be Gecko, or Webkit or whatever. Does WxRuby have anything like
this? (I’ve tried looking around and haven’t found anything, but I’ve
found you can easily miss this kind of thing.)

thanks,
Dan

Daniel L. wrote:

Alex F. wrote:

The wxRuby team is pleased to invite you to try the latest version of
wxRuby, 1.9.4. [ http://wxruby.rubyforge.org ]

I’d love to give this a go for my latest project, but there’s one thing
I need and it’s non-negotiable: a browser widget (HTML/CSS/Javascript).
Could be Gecko, or Webkit or whatever. Does WxRuby have anything like
this? (I’ve tried looking around and haven’t found anything, but I’ve
found you can easily miss this kind of thing.)

http://wxruby.rubyforge.org/doc/#html

Best regards,

Jari W.

On Jan 18, 2008 1:35 PM, Alex F. [email protected] wrote:

I’d love to give this a go for my latest project, but there’s one thing
I need and it’s non-negotiable: a browser widget (HTML/CSS/Javascript).

The one toolkit I know it’s possible with is GTK, because Kazehakase
uses it.

http://kazehakase.sourceforge.jp/
http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk%3A%3AMozEmbed

Daniel Brumbaugh K.

Daniel L. wrote:

Alex F. wrote:

The wxRuby team is pleased to invite you to try the latest version of
wxRuby, 1.9.4. [ http://wxruby.rubyforge.org ]

I’d love to give this a go for my latest project, but there’s one thing
I need and it’s non-negotiable: a browser widget (HTML/CSS/Javascript).

Thanks for the interest, but unfortunately there’s nothing that meets
that spec. Wx::HtmlWindow is a nice hypertext+images widget, but no CSS
or JS.

There are various projects wrapping Webkit and Gecko for wxWidgets, but
nothing stable or integrated enough to add to wxRuby yet.

Maybe your best bet would be to see if Qt/Ruby includes a KHTML-based
widget. However I’ve not been able to find a Qt/Ruby API reference to
check.

alex

In my opinion, a binding to wxWidgets is a great chance for GUIs with
ruby, but I’m wondering, if its very ruby-like.
Lets take the following extract of the tutorial (frames, part 1)

btn = Wx::Button.new(panel, -1, name + " (Close me)", 
Wx::Point.new(45,55))
evt_button(btn.get_id()) {|event| destroy()}

In my opinion, the button itself should handle its events and not the
frame.
And even if the frame has to handle it, why does evt_button await an ID
and not simply the button instance itself?

Maybe there are good reasons for this behaviour, but I cant see them.

Alex F. wrote:

Thanks for the interest, but unfortunately there’s nothing that meets
that spec. Wx::HtmlWindow is a nice hypertext+images widget, but no CSS
or JS.

Thank you for your replies. WxRuby looks very nice though! Looking
forward to using it for something.

best,
Dan

Alex,

I was trying to follow the instruction on wxruby page to install it
and play with the sample programs. But still couldn’t get it right.
Can you please shed some light?


First, I installed wxruby gem by “gem install wxruby”

The message was as follows.

Updating metadata for 11 gems from http://gems.rubyforge.org

complete
Successfully installed wxruby-1.9.4-x86-mswin32
1 gem installed


Second, I was trying to run the sample “minimal.rb” program in “C:\ruby
\lib\ruby\gems\1.8\gems\wxruby-1.9.4-x86-mswin32\samples\minimal” by
the following command.

ruby C:\ruby\lib\ruby\gems\1.8\gems\wxruby-1.9.4-x86-mswin32\samples
\minimal\minimal.rb

The error message was:

C:/ruby/lib/ruby/gems/1.8/gems/wxruby-1.9.4-x86-mswin32/samples/
minimal/minimal.rb:10:in `load’:
no such file to load – wx (LoadError)
from C:/ruby/lib/ruby/gems/1.8/gems/wxruby-1.9.4-x86-mswin32/
samples/minimal/minimal.rb:10


The web site says I should have “require ‘rubygems’”. I added it as
the first line in the program. But it still didn’t work and showed the
following error message.

minimal.rb:11:in `load’: no such file to load – wx (LoadError)
from minimal.rb:11

Please kindly let me know what was wrong… Thanks very much!

My environment:

  • Windows XP
  • Ruby 1.8.6
  • Gem 0.9.5
  • Wxruby: 1.9.4.

On [Thu, 06.03.2008 01:09], newbie wrote:

the following command.
samples/minimal/minimal.rb:10

My environment:

  • Windows XP
  • Ruby 1.8.6
  • Gem 0.9.5
  • Wxruby: 1.9.4.

Replace the line “load ‘wx’” with “require ‘wx’” and it should work. Its
somewhere at the top.

Dominik H. wrote:

In my opinion, a binding to wxWidgets is a great chance for GUIs with ruby, but I’m wondering, if its very ruby-like.
Lets take the following extract of the tutorial (frames, part 1)

As the tutorial front page warns, some of that material is dated. Much
more ruby-like syntax is permitted now. The API docs and many of the
bundled samples are more current.

btn = Wx::Button.new(panel, -1, name + " (Close me)", Wx::Point.new(45,55))
> evt_button(btn.get_id()) {|event| destroy()}

could be written:

btn = Wx::Button.new(panel,
:label => “#{name} (Close me)”,
:pos => [45, 55])
evt_button(btn) { close }

In my opinion, the button itself should handle its events and not the frame.

Both are valid programming strategies: you might want to encapsulate a
set of behaviours in a ruby subclass of a widget like a button, or have
a coherent group of interactions managed by a particular frame or
dialog.

Anyway, either is possible. CommandEvents from controls like Button
bubble upwards to their containing windows. The event handling page in
the docs discusses this in detail:
http://wxruby.rubyforge.org/doc/eventhandlingoverview.html

And even if the frame has to handle it, why does evt_button await an ID and not simply the button instance itself?

Event handlers have for numerous versions accepted IDs or just the
instance itself.

Maybe there are good reasons for this behaviour, but I cant see them.

In most cases, like you say, using an object is preferable.

You’d normally only use an ID now with “special” identifiers like
Wx::ID_EXIT or Wx::ID_ABOUT. The great advantage of using these special
ids to identify, for example, menu items is that they will get all the
OS-standard behaviour on different platforms. A Wx::ID_EXIT menu item
will be labelled “Exit” on Windows and GTK, and will get the
desktop-standard menu icon on the latter. But on OS X it will be called
“Quit” and will be located in the Application-name menu, not the File
menu.

This kind of attention to GUI platform standards is one of
wxRuby/wxWidget’s strengths, along with accessibility. GTK apps, for
example, feel clumsy and look foreign on OS X in particular. I’m not
picking on GTK - it’s an excellent toolkit too, and wxRuby uses it on
Linux - but it’s a matter of choosing the right GUI library given the
target platforms and user group for any given project.

cheers
alex