Hi,
i am stuck with a weird error with gnomecanvas please see the example
below (I know it's deprecated, but goocanvas binding is missing
methods).
The code is working well with ruby 1.8 but in ruby 1.9 i got the error:
test.rb:18:in `set_property': wrong argument type Array (expected
Struct) (TypeError)
from test.rb:18:in `initialize'
from test.rb:18:in `new'
from test.rb:18:in `<main>'
any idea how i can bypass that ?
thanks,
david
####################################################################################
#!/usr/bin/ruby
require 'gtk2'
require 'gnomecanvas2'
Gtk.init
w = Gtk::Window.new
canvas = Gnome::Canvas.new(true)
w.add canvas
group = Gnome::CanvasGroup.new(canvas.root,{:x => 10.0,:y => 10.0})
points = [[20.0, 0.0], [0.0, 20.0], [20.0, 40.0], [40.0, 20.0]]
b= {:points => points, :fill_color_rgba => 0xff000080, :outline_color
=> "black"}
p b.class
#below is the line where the error occurs
cp = Gnome::CanvasPolygon.new(group, b)
w.show_all
Gtk.main
on 2012-11-06 12:37
on 2012-11-06 22:37
I understand about needing gnomecanvas. I won't be able to be able to
use goocanvas for some time.
I'll see if I can help out here. Which version of the bindings are you
using.
I'm running
Ruby 1.9.2p320
Gtk::BINDING_VERSION [1, 1, 3]
Gtk::VERSION [2, 10, 4]
I build my own Ruby build W/ Ruby/Gnome bindings. Since gnomecanvas, and
a few others are not in the most recent release's, I just grab them out
of the last build that had them, 0.95.
I have a build script like this
set gnomeTarget = ruby-gnome2-all-1.1.3
rm -rf $gnomeTarget
tar xf $gnomeTarget.tar.gz
rm -rf ruby-gnome2-all-0.90.5
tar xf ruby-gnome2-all-0.90.5.tar.gz
#add some old gnome modules in
cp -rp ruby-gnome2-all-0.90.5/libart $gnomeTarget
cp -rp ruby-gnome2-all-0.90.5/gnomecanvas $gnomeTarget
cp -rp ruby-gnome2-all-0.90.5/gnome $gnomeTarget
cd $gnomeTarget
$instDir/bin/ruby extconf.rb
make install
Ok, I got off topic here. So I am basically using ruby-gnome2 1.13, with
the gnomecanvas from 0.95.
Get the bindings version you are using. Try running
require 'gtk2'
puts "Gtk::BINDING_VERSION #{Gtk::BINDING_VERSION}"
puts "Gtk::VERSION #{Gtk::VERSION}"
on 2012-11-06 22:53
Sorry, I forgot to mention, under my setup, your example is working fine on Ruby 1.9.2. If you really need to support older gnomecanvas and stuff. I highly recommend not relying on the OS default built in ruby(/usr/bin/ruby) Building your own ruby build is the way to go. Actually, I'd never recommend using an OS's own distribution of Ruby.. but that is just me. I hate to rely on the OS or distributor to keep up with things when I can help it.
on 2012-11-07 00:30
Hi, i double checked the lib installed and compiled on my system (ubuntu 12.10 and ruby-gnome2 from svn), now it's working well .. #ruby1.8 test.rb "RUBY VERSION 1.8.7" Gtk::BINDING_VERSION 113 Gtk::VERSION 22413 #ruby1.9.3 test.rb "RUBY VERSION 1.9.3" Gtk::BINDING_VERSION [1, 1, 3] Gtk::VERSION [2, 24, 13] thanks ! david On Tue, Nov 6, 2012 at 10:53 PM, Grant Schoep
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.