Togl widget, where to install it?

  • Thread starter Massimiliano Mirra - bard
  • Start date
M

Massimiliano Mirra - bard

I downloaded and built the ToGL tk widget for OpenGL from togl.sf.net.
Samples run fine (well, most of them).

I downloaded and built rbogl-0.32b.tgz (OpenGL bindings for Ruby). I
put opengl.so and glut.so in RUBYLIB. Samples run fine.

I downloaded the ToGL bridge for ruby from
http://mirrors.sunsite.dk/ruby/contrib/togl.tar.gz. I put the togl.rb
file in RUBYLIB. This is what I get when I try to run test.rb or any
other sample:


bard@prism:~/workspace/ruby/tk$ ruby -d test.rb
test.rb:10: warning: Clear (...) interpreted as method call
/usr/lib/ruby/1.6/complex.rb:335: warning: discarding old **
/usr/lib/ruby/1.6/mathn.rb:16: warning: discarding old gcd2
/usr/lib/ruby/1.6/mathn.rb:117: warning: discarding old inspect
/usr/lib/ruby/1.6/mathn.rb:225: warning: discarding old sqrt
tcltklib: Tcl_FindExecutable
tcltklib: Tcl_CreateInterp
tcltklib: Tcl_Init
tcltklib: Tk_Init
tcltklib: Tcl_StaticPackage("Tk")
tcltklib: Tcl_CreateObjCommand("ruby")
tcltklib: Tcl_Eval(array get tcl_platform)
tcltklib: (TCL_Eval result) 0
["encoding", "system"]
=> "encoding system"
/usr/lib/ruby/1.6/tk.rb:887: warning: instance variable @encoding not initialized
==> "iso8859-1"
tcltklib: Tcl_Eval(global auto_path; set auto_path "/usr/lib/tcl8.3 /usr/lib /usr/lib/tk8.3")
tcltklib: (TCL_Eval result) 0
"create_self has no arg"
["togl", ".w0000"]
=> "togl .w0000"
Exception `NameError' at /usr/lib/ruby/1.6/tk.rb:889 - invalid command name `togl'
Exception `RuntimeError' at /usr/lib/ruby/1.6/tk.rb:889 - invalid command name "togl"
Exception `NameError' at /usr/lib/ruby/1.6/tk.rb:604 - invalid command name `togl'
/usr/lib/ruby/1.6/tk.rb:604:in `tk_call': invalid command name `togl' (NameError)
from /home/bard/lib/ruby/togl.rb:54:in `create_self'
from /usr/lib/ruby/1.6/tk.rb:2229:in `initialize'
from test.rb:3:in `new'
from test.rb:3
tcltklib: Tcl_DeleteInterp



Where should the togl.so be put in order for ruby/tk to be able to
access it? I tried the directories mentioned in the debug output
(/usr/lib/tcl8.3 /usr/lib /usr/lib/tk8.3) with no result.
 
H

Hidetoshi NAGAI

Hi,

From: Massimiliano Mirra - bard <[email protected]>
Subject: Togl widget, where to install it?
Date: Thu, 17 Jul 2003 08:11:54 +0900
Message-ID: said:
["togl", ".w0000"]
=> "togl .w0000"
Exception `NameError' at /usr/lib/ruby/1.6/tk.rb:889 - invalid command name `togl'
Exception `RuntimeError' at /usr/lib/ruby/1.6/tk.rb:889 - invalid command name "togl"
Exception `NameError' at /usr/lib/ruby/1.6/tk.rb:604 - invalid command name `togl'
/usr/lib/ruby/1.6/tk.rb:604:in `tk_call': invalid command name `togl' (NameError)
from /home/bard/lib/ruby/togl.rb:54:in `create_self'
from /usr/lib/ruby/1.6/tk.rb:2229:in `initialize'
from test.rb:3:in `new'
from test.rb:3
tcltklib: Tcl_DeleteInterp

Where should the togl.so be put in order for ruby/tk to be able to
access it? I tried the directories mentioned in the debug output
(/usr/lib/tcl8.3 /usr/lib /usr/lib/tk8.3) with no result.

Probably, ToGL library is not loaded to Tk interpreter.
ToGL bridge for ruby requires to link the ToGL library to
tcltklib (written on the 'README.euc' file). If the library
cannot create as a loadable module, 'link to tcltklib' is the
only way to use it on Ruby/Tk. But if your Tcl/Tk can load the
library by 'package' command, you can use TkPackage module to
load the library to Ruby/Tk. Please use TkPackage.require to
load the library. If succeed, the library will be loaded and
'togl' command will be defined on the Tk interpreter. After that,
togl.rb will work fine.

# I don't use the library.
# So, I don't check whether the library works or not.
 
M

Massimiliano Mirra - bard

Hidetoshi NAGAI said:
Well, your togl.so library is not on Tcl/Tk's auto_path, is it?
Probably, there are two ways for loading togl.so to Ruby/Tk.
(1) put togl.so on the auto_path.
or add the new path for togl.so to the auto_path
by TkPackage.add_path(new_path).

I didn't know about TkPackage.add_path, thanks, that did the trick!
 
H

Hidetoshi NAGAI

Hi,

From: Massimiliano Mirra - bard <[email protected]>
Subject: Re: Togl widget, where to install it?
Date: Fri, 18 Jul 2003 07:20:53 +0900
Message-ID: said:
I didn't know about TkPackage.add_path, thanks, that did the trick!

FYI, you can access the auto_path list by Tk:AUTO_PATH.
It is a TkVariable object. For example,
------------------------
[ruby]$ /usr/local/bin/irb -r tk
irb(main):001:0> Tk::AUTO_PATH
=> #<TkVariable: auto_path>
irb(main):002:0> Tk::AUTO_PATH.value
=> "/usr/lib/tcl8.0jp /usr/lib /usr/lib/tk8.0jp"
irb(main):003:0> Tk::AUTO_PATH.to_a
=> ["/usr/lib/tcl8.0jp", "/usr/lib", "/usr/lib/tk8.0jp"]
irb(main):004:0> Tk::AUTO_PATH.value = Tk::AUTO_PATH.to_a << '/usr/local/lib'
=> ["/usr/lib/tcl8.0jp", "/usr/lib", "/usr/lib/tk8.0jp", "/usr/local/lib"]
irb(main):005:0> Tk::AUTO_PATH.to_a
=> ["/usr/lib/tcl8.0jp", "/usr/lib", "/usr/lib/tk8.0jp", "/usr/local/lib"]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top