Newbie help, please: cannot execute Tk under Windows XP

Hello,

I'm trying to run a very simple Ruby script that employs Tk:

## BEGIN FILE ##

require 'tk'

root = TkRoot.new {title "File to Open"}

TkLabel.new(root) do
  text 'Please enter the name of a file to open: '
  pack('padx' => 15, 'pady' => 15, 'side' => 'left')
end

Tk.mainloop

## END FILE ##

Unfortunately I get the following error when it atempts to execute:

"C:\ruby\sample\james>ruby tk_test.rb
tk_test.rb:1:in `require': no such file to load -- tk (LoadError)
        from tk_test.rb:1"

Can anyone help? I am using Ruby 1.8.4 which I compiled myself using
cygwin32. I am running on XP. I've edited the Setup file in
C:\ruby\ext\Setup to enable the tcltklib and tk lines, rebuilt, and
still no go.

Interestingly, I had the same problem with the extension "WIN32OLE"
earlier yesterday, but after I copied over some lines from some sample
files, it started to work (which bugs me because my file was verbatim,
unless there was some hidden chars that I was missing or something
weird like that). I had previously rebuilt after altering the
C:\ruby\ext\Setup file to enable Win32API and win32ole, but that didn't
work until I copied over the sample file.

Thanks in advance,

James

The tcltklib.so is not included in the latest oneclick installer.
Try this :http://www.fxruby.org/doc/examples.html
Example:

#!/usr/bin/env ruby

require 'fox16'

include Fox

application = FXApp.new("Hello", "FoxTest")
main = FXMainWindow.new(application, "Hello", nil, nil, DECOR_ALL)
FXButton.new(main, "&Hello, World!", nil, application, FXApp::ID_QUIT)
application.create()
main.show(PLACEMENT_SCREEN)
application.run()

James Calivar wrote:

···

Hello,

I'm trying to run a very simple Ruby script that employs Tk:

## BEGIN FILE ##

require 'tk'

root = TkRoot.new {title "File to Open"}

TkLabel.new(root) do
  text 'Please enter the name of a file to open: '
  pack('padx' => 15, 'pady' => 15, 'side' => 'left')
end

Tk.mainloop

## END FILE ##

Unfortunately I get the following error when it atempts to execute:

"C:\ruby\sample\james>ruby tk_test.rb
tk_test.rb:1:in `require': no such file to load -- tk (LoadError)
        from tk_test.rb:1"

Can anyone help? I am using Ruby 1.8.4 which I compiled myself using
cygwin32. I am running on XP. I've edited the Setup file in
C:\ruby\ext\Setup to enable the tcltklib and tk lines, rebuilt, and
still no go.

Interestingly, I had the same problem with the extension "WIN32OLE"
earlier yesterday, but after I copied over some lines from some sample
files, it started to work (which bugs me because my file was verbatim,
unless there was some hidden chars that I was missing or something
weird like that). I had previously rebuilt after altering the
C:\ruby\ext\Setup file to enable Win32API and win32ole, but that didn't
work until I copied over the sample file.

Thanks in advance,

James

Hi 王东 -

Perhaps you didn't see that I compiled my own Ruby (not using one-click
installer). According to "Programming Ruby" the Tk extension is
bundled with the main distribution, so it should run - and in fact, I
do have a c:\ruby\tk directory, leading me to believe that it's there,
I'm just not soing something right to enable its use.

I'll have a look at the Fox GUI, too.

James

王东 wrote:

···

The tcltklib.so is not included in the latest oneclick installer.
Try this :http://www.fxruby.org/doc/examples.html
Example:

#!/usr/bin/env ruby

require 'fox16'

include Fox

application = FXApp.new("Hello", "FoxTest")
main = FXMainWindow.new(application, "Hello", nil, nil, DECOR_ALL)
FXButton.new(main, "&Hello, World!", nil, application, FXApp::ID_QUIT)
application.create()
main.show(PLACEMENT_SCREEN)
application.run()

James Calivar wrote:
> Hello,
>
> I'm trying to run a very simple Ruby script that employs Tk:
>
> ## BEGIN FILE ##
>
> require 'tk'
>
> root = TkRoot.new {title "File to Open"}
>
> TkLabel.new(root) do
> text 'Please enter the name of a file to open: '
> pack('padx' => 15, 'pady' => 15, 'side' => 'left')
> end
>
> Tk.mainloop
>
> ## END FILE ##
>
>
> Unfortunately I get the following error when it atempts to execute:
>
> "C:\ruby\sample\james>ruby tk_test.rb
> tk_test.rb:1:in `require': no such file to load -- tk (LoadError)
> from tk_test.rb:1"
>
> Can anyone help? I am using Ruby 1.8.4 which I compiled myself using
> cygwin32. I am running on XP. I've edited the Setup file in
> C:\ruby\ext\Setup to enable the tcltklib and tk lines, rebuilt, and
> still no go.
>
> Interestingly, I had the same problem with the extension "WIN32OLE"
> earlier yesterday, but after I copied over some lines from some sample
> files, it started to work (which bugs me because my file was verbatim,
> unless there was some hidden chars that I was missing or something
> weird like that). I had previously rebuilt after altering the
> C:\ruby\ext\Setup file to enable Win32API and win32ole, but that didn't
> work until I copied over the sample file.
>
> Thanks in advance,
>
> James

James Calivar wrote:

Hi 王东 -

Perhaps you didn't see that I compiled my own Ruby (not using one-click
installer). According to "Programming Ruby" the Tk extension is
bundled with the main distribution, so it should run - and in fact, I
do have a c:\ruby\tk directory, leading me to believe that it's there,
I'm just not soing something right to enable its use.

I'll have a look at the Fox GUI, too.

James

http://members.chello.nl/~k.vangelder/ruby/learntk/
says
"If you installed Ruby yourself, possibly the Tk bindings do not work.
First, make sure you have tcl/tk installed. Then look here.
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/15590 "

I'm not sure that's the problem, but it seems a good thing to check.

···

--
Posted via http://www.ruby-forum.com/\.

Hi 王东 -

Perhaps you didn't see that I compiled my own Ruby (not using one-click
installer). According to "Programming Ruby" the Tk extension is
bundled with the main distribution, so it should run - and in fact, I
do have a c:\ruby\tk directory, leading me to believe that it's there,
I'm just not soing something right to enable its use.

I'll have a look at the Fox GUI, too.

James

No, the Tk libs are not bundled with Ruby, only the interface to Tk.
You must still install he actual Tk libs (such as those from
ActiveState).

Curt

···

On 9/6/06, James Calivar <amheiserbush@yahoo.com.au> wrote:

王东 wrote:
> The tcltklib.so is not included in the latest oneclick installer.
> Try this :http://www.fxruby.org/doc/examples.html
> Example:
>
> #!/usr/bin/env ruby
>
> require 'fox16'
>
> include Fox
>
> application = FXApp.new("Hello", "FoxTest")
> main = FXMainWindow.new(application, "Hello", nil, nil, DECOR_ALL)
> FXButton.new(main, "&Hello, World!", nil, application, FXApp::ID_QUIT)
> application.create()
> main.show(PLACEMENT_SCREEN)
> application.run()
>
> James Calivar wrote:
> > Hello,
> >
> > I'm trying to run a very simple Ruby script that employs Tk:
> >
> > ## BEGIN FILE ##
> >
> > require 'tk'
> >
> > root = TkRoot.new {title "File to Open"}
> >
> > TkLabel.new(root) do
> > text 'Please enter the name of a file to open: '
> > pack('padx' => 15, 'pady' => 15, 'side' => 'left')
> > end
> >
> > Tk.mainloop
> >
> > ## END FILE ##
> >
> > Unfortunately I get the following error when it atempts to execute:
> >
> > "C:\ruby\sample\james>ruby tk_test.rb
> > tk_test.rb:1:in `require': no such file to load -- tk (LoadError)
> > from tk_test.rb:1"
> >
> > Can anyone help? I am using Ruby 1.8.4 which I compiled myself using
> > cygwin32. I am running on XP. I've edited the Setup file in
> > C:\ruby\ext\Setup to enable the tcltklib and tk lines, rebuilt, and
> > still no go.
> >
> > Interestingly, I had the same problem with the extension "WIN32OLE"
> > earlier yesterday, but after I copied over some lines from some sample
> > files, it started to work (which bugs me because my file was verbatim,
> > unless there was some hidden chars that I was missing or something
> > weird like that). I had previously rebuilt after altering the
> > C:\ruby\ext\Setup file to enable Win32API and win32ole, but that didn't
> > work until I copied over the sample file.
> >
> > Thanks in advance,
> >
> > James

So I guess nobody can help me?? I still can't get Tk to run under
Ruby.

James

James Calivar wrote:

···

Hi 王东 -

Perhaps you didn't see that I compiled my own Ruby (not using one-click
installer). According to "Programming Ruby" the Tk extension is
bundled with the main distribution, so it should run - and in fact, I
do have a c:\ruby\tk directory, leading me to believe that it's there,
I'm just not soing something right to enable its use.

I'll have a look at the Fox GUI, too.

James

王东 wrote:
> The tcltklib.so is not included in the latest oneclick installer.
> Try this :http://www.fxruby.org/doc/examples.html
> Example:
>
> #!/usr/bin/env ruby
>
> require 'fox16'
>
> include Fox
>
> application = FXApp.new("Hello", "FoxTest")
> main = FXMainWindow.new(application, "Hello", nil, nil, DECOR_ALL)
> FXButton.new(main, "&Hello, World!", nil, application, FXApp::ID_QUIT)
> application.create()
> main.show(PLACEMENT_SCREEN)
> application.run()
>
>
> James Calivar wrote:
> > Hello,
> >
> > I'm trying to run a very simple Ruby script that employs Tk:
> >
> > ## BEGIN FILE ##
> >
> > require 'tk'
> >
> > root = TkRoot.new {title "File to Open"}
> >
> > TkLabel.new(root) do
> > text 'Please enter the name of a file to open: '
> > pack('padx' => 15, 'pady' => 15, 'side' => 'left')
> > end
> >
> > Tk.mainloop
> >
> > ## END FILE ##
> >
> >
> > Unfortunately I get the following error when it atempts to execute:
> >
> > "C:\ruby\sample\james>ruby tk_test.rb
> > tk_test.rb:1:in `require': no such file to load -- tk (LoadError)
> > from tk_test.rb:1"
> >
> > Can anyone help? I am using Ruby 1.8.4 which I compiled myself using
> > cygwin32. I am running on XP. I've edited the Setup file in
> > C:\ruby\ext\Setup to enable the tcltklib and tk lines, rebuilt, and
> > still no go.
> >
> > Interestingly, I had the same problem with the extension "WIN32OLE"
> > earlier yesterday, but after I copied over some lines from some sample
> > files, it started to work (which bugs me because my file was verbatim,
> > unless there was some hidden chars that I was missing or something
> > weird like that). I had previously rebuilt after altering the
> > C:\ruby\ext\Setup file to enable Win32API and win32ole, but that didn't
> > work until I copied over the sample file.
> >
> > Thanks in advance,
> >
> > James

James Calivar wrote:

So I guess nobody can help me?? I still can't get Tk to run under
Ruby.

James

It may just be the gateway acting up again, but you seem to be ignoring
several people trying to help you.

···

--
Posted via http://www.ruby-forum.com/\.

I'm not sure what you mean. Only you and one other person are showing
up as replies on Google. I don't have a dedicated news reader. How
many replies are you seeing to my original post?

James

William Crawford wrote:

···

James Calivar wrote:
> So I guess nobody can help me?? I still can't get Tk to run under
> Ruby.
>
> James

It may just be the gateway acting up again, but you seem to be ignoring
several people trying to help you.

--
Posted via http://www.ruby-forum.com/\.

On Newbie help, please: cannot execute Tk under Windows XP - Ruby - Ruby-Forum appears the whole thread. The
question you didn't respond to was: do you have tcl/tk installed? by
William and Curt.

···

On 9/7/06, James Calivar <amheiserbush@yahoo.com.au> wrote:

I'm not sure what you mean. Only you and one other person are showing
up as replies on Google. I don't have a dedicated news reader. How
many replies are you seeing to my original post?

James

William Crawford wrote:
> James Calivar wrote:
> > So I guess nobody can help me?? I still can't get Tk to run under
> > Ruby.
> >
> > James
>
> It may just be the gateway acting up again, but you seem to be ignoring
> several people trying to help you.

OK, thanks - I never saw that message. I think I'll just migrate to
looking forectly at the Ruby forums instead of going through Google.

I'll have a look at those suggestions and then reply once I figure it
out.

Thanks,

James

Jan Svitok wrote:

···

On Newbie help, please: cannot execute Tk under Windows XP - Ruby - Ruby-Forum appears the whole thread. The
question you didn't respond to was: do you have tcl/tk installed? by
William and Curt.

Or better yet, join the source: ruby-talk (the information is on the
Ruby home page).

-austin

···

On 9/7/06, James Calivar <amheiserbush@yahoo.com.au> wrote:

OK, thanks - I never saw that message. I think I'll just migrate to
looking forectly at the Ruby forums instead of going through Google.

I'll have a look at those suggestions and then reply once I figure it
out.

--
Austin Ziegler * halostatue@gmail.com * http://www.halostatue.ca/
               * austin@halostatue.ca * You are in a maze of twisty little passages, all alike. // halo • statue
               * austin@zieglers.ca