GUI with ruby on windows

hello friends, i am a begginer and i have a litlle question, how can i
make a GUI for windows (of coursr, using ruby as my programming
language XD XD), and if you have a little toturial about it, i’d be glad

you could look for wxWigdets it can make guis for windows and linux and
mac too.

for ruby support you have wxRuby or GitHub - Hanmac/rwx: wxWidgets binding for ruby

but you can also try rubyGTK or rubyQT (i dont konw if this names are
correct)

Hello,
as a beginner on Windows, you should use RubyInstaller, so you already
have a simple and nice GUI installed (if you set the option during
installation), it’s Tk.

two good places to start with it :

when installing Ruby on Windows with RubyInstaller, you only have to set
the two options and there’s nothing else to do, Tk is installed and
works great.

not necessary for Tk, but you should also install the Devkit available
on the RubyInstaller website…

Fred

You can try qt4ruby…

Qt is the best GUI environment (if not with Ruby).

I used it sometime ago, but I think it’s kinda hard to use Qt with ruby
because few people use it.

Many prefer Shoes, Tk etc.

Some tutorials can be found here…
http://techbase.kde.org/Development/Tutorials/Qt4_Ruby_Tutorial

Also voidrealms has got some Youtube tutorials on using Qt (with C++).
They can be of great help after you find comfort in Ruby and if you are
good with C++.

Hope that helps!

On 16 May 2012 03:52, David A. [email protected] wrote:

hello friends, i am a begginer and i have a litlle question, how can i
make a GUI for windows (of coursr, using ruby as my programming
language XD XD), and if you have a little toturial about it, i’d be glad

I’m going to be slightly controversial here and ask why you want to use
Ruby to build a Window’s GUI? There are lots of great reasons to do so
(it’s a beautiful language, your GUI will probably be portable among
multiple OSs, the community is great, etc), and if it’s purely for a
learning exercise, then brilliant. However, if you’re creating a Windows
only, GUI-based production application, that needs to feel natively to
Windows, then, as a beginner, there are maybe easier solutions. I’d
personally recommend exploring C#.net and the technologies around it.
It’s
pretty simple and quick to learn, and Visual Studio makes creating the
Window’s GUIs stupidly easy.

Definitely explore the options people have suggested, and if you don’t
end
up using Ruby for this, do invest the time to learn it anyway. It’ll
make
your life happier.

Jeremy W.

On 2012-05-16 13:50, jake kaiden wrote:

hi David,

check out Shoes - it rocks!

http://shoesrb.com/
GitHub - ashbb/shoes_tutorial_walkthrough: Shoes - THE TUTORIAL WALKTHROUGH written by _why

there’s also green Shoes, which installs as a gem -

gem install green_shoes

According to File: README — Documentation for green_shoes (1.1.358), all
you need is

Ruby 1.9 or above
Gems 1.5 or above
ruby-gtk2 package 0.90.7 or above

I have:
Ruby 1.9.3
Gem 1.8.11
ruby-gtk2 1.0.3-1

Yet, I’m told:

$ sudo gem install green_shoes
Building native extensions. This could take a while…
ERROR: Error installing green_shoes:
ERROR: Failed to build gem native extension.

    /usr/bin/ruby1.9.1 extconf.rb

hi David,

check out Shoes - it rocks!

there’s also green Shoes, which installs as a gem -

gem install green_shoes

lots of examples here:

http://shoes-tutorial-note.heroku.com/

  • j

On 2012-05-16 17:43, Bartosz Dziewoński wrote:

ERROR: Error installing green_shoes:
ERROR: Failed to build gem native extension.

   /usr/bin/ruby1.9.1 extconf.rb

Is this the entire backtrace? Because it doesn’t look like it is. We
can’t help you unless we know the problem…

I thought this was the essence, but here is the full backtrace:

$ sudo gem install green_shoes
Building native extensions. This could take a while…
ERROR: Error installing green_shoes:
ERROR: Failed to build gem native extension.

    /usr/bin/ruby1.9.1 extconf.rb

checking for -Wall option to compiler… yes
checking for -Waggregate-return option to compiler… yes
checking for -Wcast-align option to compiler… yes
checking for -Wextra option to compiler… yes
checking for -Wformat=2 option to compiler… yes
checking for -Winit-self option to compiler… yes
checking for -Wlarger-than-65500 option to compiler… yes
checking for -Wmissing-declarations option to compiler… yes
checking for -Wmissing-format-attribute option to compiler… yes
checking for -Wmissing-include-dirs option to compiler… yes
checking for -Wmissing-noreturn option to compiler… yes
checking for -Wmissing-prototypes option to compiler… yes
checking for -Wnested-externs option to compiler… yes
checking for -Wold-style-definition option to compiler… yes
checking for -Wpacked option to compiler… yes
checking for -Wp,-D_FORTIFY_SOURCE=2 option to compiler… yes
checking for -Wpointer-arith option to compiler… yes
checking for -Wswitch-default option to compiler… yes
checking for -Wswitch-enum option to compiler… yes
checking for -Wundef option to compiler… yes
checking for -Wunsafe-loop-optimizations option to compiler… yes
checking for -Wwrite-strings option to compiler… yes
checking for rb_define_alloc_func() in ruby.h… yes
checking for rb_block_proc() in ruby.h… yes
checking for new allocation framework… yes
checking for attribute assignment… no
checking for Win32 OS… no
checking for gobject-2.0… no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
–with-opt-dir
–without-opt-dir
–with-opt-include
–without-opt-include=${opt-dir}/include
–with-opt-lib
–without-opt-lib=${opt-dir}/lib
–with-make-prog
–without-make-prog
–srcdir=.
–curdir
–ruby=/usr/bin/ruby1.9.1
–with-pkg-config
–without-pkg-config
–with-override-variables
–without-override-variables

Gem files will remain installed in /var/lib/gems/1.9.1/gems/glib2-1.1.3
for inspection.
Results logged to
/var/lib/gems/1.9.1/gems/glib2-1.1.3/ext/glib2/gem_make.out

2012/5/16 Wybo D. [email protected]:

   ERROR: Failed to build gem native extension.

   /usr/bin/ruby1.9.1 extconf.rb

Is this the entire backtrace? Because it doesn’t look like it is. We
can’t help you unless we know the problem…

– Matma R.

hi,

i’ve forwarded this post to the shoes mailing list -
http://librelist.com/browser/shoes/ (join here http://librelist.com/) -
hopefully we can get you up and running with shoes before long…

  • j

Hi Wybo, J and folks,

@J,

Thank you for forwarding this post to Shoes-ML.
I didn’t notice this post in ruby-talk ML. xx-P

@Wybo,

What platform are you using?

According to File: README — Documentation for green_shoes (1.1.358),
all you need is
Ruby 1.9 or above
Gems 1.5 or above
ruby-gtk2 package 0.90.7 or above
Ah, sorry. This information may not be correct for now. xx-P

You wrote:

I have:
Ruby 1.9.3
Gem 1.8.11
ruby-gtk2 1.0.3-1

And got this error:

Gem files will remain installed in /var/lib/gems/1.9.1/gems/glib2-1.1.3
for inspection.
Results logged to
/var/lib/gems/1.9.1/gems/glib2-1.1.3/ext/glib2/gem_make.out

I’m not sure, but that looks like a conflict of glib2 version.
Could you try to use the latest gtk2 and dependent gems?
I think the latest version is 1.1.3.

http://rubygems.org/gems/gtk2

If gem install green_shoes doesn’t work well, try out doing first gem install gtk2, then gem install green_shoes.

ashbb

ashbb shoeser wrote in post #1061123:

Hi Wybo, J and folks,

@J,

Thank you for forwarding this post to Shoes-ML.
I didn’t notice this post in ruby-talk ML. xx-P

@Wybo,

What platform are you using?

According to File: README — Documentation for green_shoes (1.1.358),
all you need is
Ruby 1.9 or above
Gems 1.5 or above
ruby-gtk2 package 0.90.7 or above
Ah, sorry. This information may not be correct for now. xx-P

You wrote:

I have:
Ruby 1.9.3
Gem 1.8.11
ruby-gtk2 1.0.3-1

And got this error:

Gem files will remain installed in /var/lib/gems/1.9.1/gems/glib2-1.1.3
for inspection.
Results logged to
/var/lib/gems/1.9.1/gems/glib2-1.1.3/ext/glib2/gem_make.out

I’m not sure, but that looks like a conflict of glib2 version.
Could you try to use the latest gtk2 and dependent gems?
I think the latest version is 1.1.3.

gtk2 | RubyGems.org | your community gem host

If gem install green_shoes doesn’t work well, try out doing first gem install gtk2, then gem install green_shoes.

ashbb

$ gem install gtk2 gives me the same error:

sudo gem install gtk2
Building native extensions. This could take a while…
ERROR: Error installing gtk2:
ERROR: Failed to build gem native extension.

    /usr/bin/ruby1.9.1 extconf.rb

checking for -Wall option to compiler… yes
checking for -Waggregate-return option to compiler… yes
checking for -Wcast-align option to compiler… yes
checking for -Wextra option to compiler… yes
checking for -Wformat=2 option to compiler… yes
checking for -Winit-self option to compiler… yes
checking for -Wlarger-than-65500 option to compiler… yes
checking for -Wmissing-declarations option to compiler… yes
checking for -Wmissing-format-attribute option to compiler… yes
checking for -Wmissing-include-dirs option to compiler… yes
checking for -Wmissing-noreturn option to compiler… yes
checking for -Wmissing-prototypes option to compiler… yes
checking for -Wnested-externs option to compiler… yes
checking for -Wold-style-definition option to compiler… yes
checking for -Wpacked option to compiler… yes
checking for -Wp,-D_FORTIFY_SOURCE=2 option to compiler… yes
checking for -Wpointer-arith option to compiler… yes
checking for -Wswitch-default option to compiler… yes
checking for -Wswitch-enum option to compiler… yes
checking for -Wundef option to compiler… yes
checking for -Wunsafe-loop-optimizations option to compiler… yes
checking for -Wwrite-strings option to compiler… yes
checking for rb_define_alloc_func() in ruby.h… yes
checking for rb_block_proc() in ruby.h… yes
checking for new allocation framework… yes
checking for attribute assignment… no
checking for Win32 OS… no
checking for gobject-2.0… no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
–with-opt-dir
–without-opt-dir
–with-opt-include
–without-opt-include=${opt-dir}/include
–with-opt-lib
–without-opt-lib=${opt-dir}/lib
–with-make-prog
–without-make-prog
–srcdir=.
–curdir
–ruby=/usr/bin/ruby1.9.1
–with-pkg-config
–without-pkg-config
–with-override-variables
–without-override-variables

Gem files will remain installed in /var/lib/gems/1.9.1/gems/glib2-1.1.3
for inspection.
Results logged to
/var/lib/gems/1.9.1/gems/glib2-1.1.3/ext/glib2/gem_make.out

You could also try using IronRuby in Visual Studio 2010. You can
develop using the standard WinForms libraries but you can’t use the
visual interface designer like with C#; you have to hand code all your
forms.

There’s currently a bug that causes VS 2010 to not know where the
IronRuby interpreter is but if you install NuGet then Install IronRuby
it works fine.

http://nuget.codeplex.com/
http://ironruby.codeplex.com/releases
http://www.microsoft.com/visualstudio/en-us

Here’s what the default WinForms app looks like:

Code Start

require ‘System.Windows.Forms’

include System::Windows::Forms

class MyForm < Form
def initialize
button = Button.new
button.text = ‘Click Me’
controls.add button
end
end

form = MyForm.new
Application.run form

Code End

Hi,

In [email protected]
“Re: GUI with ruby on windows” on Sat, 19 May 2012 17:00:49 +0900,
Wybo D. [email protected] wrote:

checking for gobject-2.0… no

Install libgtk2.0-dev package and try again:

% sudo apt-get install -y libgtk2.0-dev
% sudo gem install gtk2

Thanks,

ruby-gtk works ok on windows.

You should stick to make only simple GTK apps though. I found that the
more complicated GUIs that I wrote, tended to be difficult to change.

(On my todo list is still to write an editor in ruby-gtk though. But I
dont know if this is easy enough to start. When I start it, I want to
maintain it and use daily, and right now it seems like too much work.
The more people using ruby-gtk though, the more potential helpers we
could have on that.)

Hi Jeremy,

Chiming in a long while after your message below…

On 16/5/2012 8:42 PM, Jeremy W. wrote:

Visual Studio makes creating the Window’s GUIs stupidly easy.

I normally use Embarcadero’s C++ Builder for doing GUI work for Windows,
but one of the reasons I am going through older posts about Windows GUI
is because I have a bunch of Ruby scripts that do quite a few things,
and some of the stuff would be easier if driven through a GUI.

Best Regards,
Mohit.
29/7/2012 | 3:04 PM.

On 2012-05-19 10:14, Kouhei S. wrote:

% sudo apt-get install -y libgtk2.0-dev
% sudo gem install gtk2

That did it, thanks!

Have you tried Glimmer (Ruby Desktop Development GUI Library)?

https://github.com/AndyObtiva/glimmer

Unlike most other GUI libraries, Glimmer does things the Ruby way, providing a lightweight and maintainable declarative GUI DSL. It also comes with scaffolding and native-executable packaging support, making it possible to release an app as an executable with one Glimmer command.