Tk query

115 views
Skip to first unread message

bogbasic

unread,
Dec 12, 2011, 5:08:42 PM12/12/11
to ruby...@googlegroups.com
Hello, I have put together a little prog that uses Tk for a simple GUI and it runs fine as a .rb file. However if I convert it to an exe file with ocra....

ocra --no-dep-run --add-all-core fred.rb

.... I get an exe file with no errors but if I run it, I get an error in 'initialise': Can't find a usable init.tcl in the following directories....This probably means tcl wasn't installed properly.

Any clues much appreciated.

Thanks, Jon.

David Simon

unread,
Dec 12, 2011, 5:10:49 PM12/12/11
to ruby...@googlegroups.com
If you are using a gem (or multiple gems) for tk, you'll have to give ocra that information as well, either manually or by setting up a bundler gemfile for your app. I'm guessing that's the source of your problem.
--
David Simon

Gustav Andersson

unread,
Dec 12, 2011, 5:11:43 PM12/12/11
to ruby...@googlegroups.com

bogbasic

unread,
Dec 12, 2011, 6:19:23 PM12/12/11
to OCRA One-Click Application Builder
Many thanks indeed for the very quick replies. There is just one .rb
file that I am trying to compile and I am not using any gems for Tk as
far as I know - just a single script that calls bits of Tk. I'm really
thick at all this. I tried the following....

ocra fred.rb --windows c:\Ruby193\lib\tcltk\ --add-all-core --no-dep-
run --no-autoload

... and it produced a .exe file. However, on running the .exe, the
program runs for a bit without producing a GUI window and then it just
dies with no errors.

Any clues much appreciated.

On Dec 12, 10:11 pm, Gustav Andersson <gustavlidi...@gmail.com> wrote:
> Googled and found

> this:http://stackoverflow.com/questions/7510748/ruby-deploying-an-exe-with...

bogbasic

unread,
Dec 13, 2011, 11:27:56 AM12/13/11
to OCRA One-Click Application Builder
Hello, tried a few more things along the lines suggested and I am
still getting the message that it can't find the init.tcl. If I run it
without --no-dep-run it picks up the DLLs for Tk but still I get that
message. Any clues at all much appreciated as I am a relative newbie
to ruby and even newer to Tk so I may be missing something obvious.
The code's here...

www.jbc.me.uk/fred.rb

... if that will help. Bests, JC.

David Simon

unread,
Dec 13, 2011, 12:17:52 PM12/13/11
to ruby...@googlegroups.com
I'm afraid you're going to have to spend some time digging around yourself in order to (a) figure out which files Tk wants that aren't being included, and (b) where they need to be in order for Tk to find them. Then, have Ocra manually include those files, and extract them to usable places (and/or set their locations in whatever environment variables are needed) before initializing Tk.
--
David Simon

bogbasic

unread,
Dec 13, 2011, 1:24:39 PM12/13/11
to OCRA One-Click Application Builder
Thanks, its sorted c/o the github discussion above which gave a
critical clue....

The thing to do is to copy the ruby file you wish to compile to the C:
\Ruby193\lib folder which contains the tcltk directory and then run
ocra there as follows....

ocra fred.rb tcltk --no-autoload

... then you can copy the resulting .exe file to wherever you want
afterwards and it runs fine.

Reply all
Reply to author
Forward
0 new messages