-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to make it work with TkRuby? #10
Comments
require 'tk' Can you try this? I'm believe it attempts to open the TK window, but at this time ocran just exits. |
@shinokaro maybe In the second example something goes wrong at ocra.rb:84. |
ocran test_tk.rb --windows=== Loading script to check dependencies |
|
tk/macpkg is a package for Macintosh. That's probably why it caused the error. Can you try the following commands?
|
Okay, thank you very much. I will gladly make a new release when we figure this out. Note: the newest TK libs don't work with the TK gem yet! I'm planning to set up wine for this and also attempt to make some automated test. I'm currently working on ruby.wasm, but will get back to this soon! |
compiled done but not executed ocran test_tk.rb --windows --gem-spec=tk --no-autoload LZMA 22.01 (x86) : Igor Pavlov : Public domain : 2022-07-15 Input size: 13508217 (12 MiB) |
@krepkiy Thanks for your patience. I confirmed that it works with the following command: ocran tk.rb --windows --gem-full=tk --add-all-core --no-autoload How to reproduce. See below or tk.rb in samples. gem install tk require 'tk'
root = TkRoot.new { title "Hello, World!" }
TkLabel.new(root) do
text 'Hello, World!'
pack { padx 15 ; pady 15; side 'left' }
end
Tk.mainloop unless defined?(Ocran) Keep in mind that if you want to use other gems, then make sure to add them manually similar to tk or use the "--gemfile Gemfile" parameter |
@Largo Thank you for trying to help me. But this option doesn't work for me either. |
Sorry, I can't work on this today, but I would recommend to try the following:
It's possible that the problem is elsewhere. Also make sure the antivirus is not interfering or try on a different machine. |
I try on another machine but the result is the same. I don't understand one point about which you wrote.
I don't understand how to put the updated code ocran. |
I downloaded the file ocran https://github.com/Largo/ocran/blob/master/bin/ocran
|
Hi, friends!
Then in the C:\Ruby32-x64\bin folder
I received the error ERROR: Stub image not available |
Hey @krepkiy It means that the stub.exe file wasn't built inside the gem... It should be built automatically when you do what you did there. However, have you tried Ocran 1.3.14? |
I tried version 1.3.14 |
Sorry, seems like tk doesn't work with ocran 1.3.16 if you know the path of init.tcl maybe it helps if you include it in the command \tk.exe
C:/Users/Andre/AppData/Local/Temp/ocran1D15E4118731/lib/ruby/gems/3.3.0/gems/tk-0.5.0/lib/tk.rb:32:in `initialize': Can't find a usable init.tcl in the following directories: (RuntimeError)
C:/Users/Andre/AppData/Local/Temp/ocran1D15E4118731/msys64/ucrt64/lib/tcl8.6 C:/Users/Andre/AppData/Local/Temp/ocran1D15E4118731/lib/tcl8.6 C:/Users/Andre/AppData/Local/Temp/lib/tcl8.6 C:/Users/Andre/
This probably means that Tcl wasn't installed properly. |
Largo |
Hello. It doesn't work for me with TkRuby.
Maybe someone knows how to make it work?
ruby 3.2.3 (2024-01-18 revision 52bb2ac0a6) [x64-mingw-ucrt]
tk (0.5.0)
ocran (1.3.15)
My file test_tk.rb
require 'tk' root = TkRoot.new { title "Ex1" } TkLabel.new(root) { text 'Hello, World!' pack { padx 55 ; pady 55; side 'left' } } Tk.mainloop
option 1
# ocran test_tk.rb --windows === Loading script to check dependencies === Attempting to trigger autoload of #<Class:Tk>::WinRegistry === Attempting to trigger autoload of #<Class:Tk>::ValidateConfigure === Attempting to trigger autoload of #<Class:Tk>::BinaryString === Attempting to trigger autoload of #<Class:Tk>::AUTO_PATH === Attempting to trigger autoload of #<Class:Tk>::Tile C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/tk-0.5.0/lib/tk.rb:2887:in
_invoke': can't invoke "font" command: application has been destroyed (RuntimeError)from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/tk-0.5.0/lib/tk.rb:2887:in
_invoke' from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/tk-0.5.0/lib/tk.rb:1932:in
_ip_invoke_core'from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/tk-0.5.0/lib/tk.rb:1965:in
_tk_call_core' from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/tk-0.5.0/lib/tk.rb:1988:in
tk_call'from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/tk-0.5.0/lib/tk/font.rb:126:in
<class:TkFont>' from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/tk-0.5.0/lib/tk/font.rb:9:in
<top (required)>'from internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb:86:in
require' from <internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:86:in
require'from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/tk-0.5.0/lib/tkextlib/tile.rb:293:in
<module:Font>' from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/tk-0.5.0/lib/tkextlib/tile.rb:281:in
module:Tile'from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/tk-0.5.0/lib/tkextlib/tile.rb:113:in
<module:Tk>' from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/tk-0.5.0/lib/tkextlib/tile.rb:112:in
<top (required)>'from internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb:86:in
require' from <internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:86:in
require'from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/ocran-1.3.15/bin/ocran:518:in
const_get' from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/ocran-1.3.15/bin/ocran:518:in
block (3 levels) in attempt_load_autoload'from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/ocran-1.3.15/bin/ocran:514:in
each' from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/ocran-1.3.15/bin/ocran:514:in
block (2 levels) in attempt_load_autoload'from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/ocran-1.3.15/bin/ocran:512:in
each' from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/ocran-1.3.15/bin/ocran:512:in
block in attempt_load_autoload'from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/ocran-1.3.15/bin/ocran:506:in
loop' from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/ocran-1.3.15/bin/ocran:506:in
attempt_load_autoload'from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/ocran-1.3.15/bin/ocran:774:in
build_exe' from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/ocran-1.3.15/bin/ocran:1307:in
block in <top (required)>'`option 2 (compiled done but not executed)
`# ocran test_tk.rb --windows --no-autoload
=== Loading script to check dependencies
=== Using default specification C:/Ruby32-x64/lib/ruby/gems/3.2.0/specifications/default/error_highlight-0.5.1.gemspec for gem error_highlight-0.5.1
=== Detected gem error_highlight-0.5.1 (loaded, files)
=== 0 files, 0 bytes
=== Using default specification C:/Ruby32-x64/lib/ruby/gems/3.2.0/specifications/default/did_you_mean-1.6.3.gemspec for gem did_you_mean-1.6.3
=== Detected gem did_you_mean-1.6.3 (loaded, files)
=== 0 files, 0 bytes
=== Using default specification C:/Ruby32-x64/lib/ruby/gems/3.2.0/specifications/default/syntax_suggest-1.1.0.gemspec for gem syntax_suggest-1.1.0
=== Detected gem syntax_suggest-1.1.0 (loaded, files)
=== 1 files, 111 bytes
=== Detected gem ocran-1.3.15 (loaded, files)
=== 6 files, 284024 bytes
=== Detected gem tk-0.5.0 (loaded, files)
=== 415 files, 2939900 bytes
=== Including 61 encoding support files (3775488 bytes, use --no-enc to exclude)
=== Building test_tk.exe
=== Adding user-supplied source files
=== Adding ruby executable rubyw.exe
=== Adding detected DLL C:/Ruby32-x64/bin/ruby_builtin_dlls/libgmp-10.dll
=== Adding detected DLL C:/Ruby32-x64/msys64/ucrt64/bin/tk86.dll
=== Adding detected DLL C:/Ruby32-x64/msys64/ucrt64/bin/tcl86.dll
=== Adding detected DLL C:/Ruby32-x64/bin/ruby_builtin_dlls/zlib1.dll
=== Adding detected DLL C:/Ruby32-x64/bin/ruby_builtin_dlls/libffi-8.dll
=== Adding external manifest C:/Ruby32-x64/bin/ruby_builtin_dlls/ruby_builtin_dlls.manifest
=== Adding library files
=== Compressing 16729037 bytes
LZMA 22.01 (x86) : Igor Pavlov : Public domain : 2022-07-15
Input size: 16729037 (15 MiB)
Output size: 4445085 (4 MiB)
=== Finished building test_tk.exe (4492721 bytes)`
option 3
# ocran test_tk.rb --windows --no-autoload --debug === Loading script to check dependencies === Using default specification C:/Ruby32-x64/lib/ruby/gems/3.2.0/specifications/default/error_highlight-0.5.1.gemspec for gem error_highlight-0.5.1 === Detected gem error_highlight-0.5.1 (loaded, files) === 0 files, 0 bytes === Using default specification C:/Ruby32-x64/lib/ruby/gems/3.2.0/specifications/default/did_you_mean-1.6.3.gemspec for gem did_you_mean-1.6.3 === Detected gem did_you_mean-1.6.3 (loaded, files) === 0 files, 0 bytes === Using default specification C:/Ruby32-x64/lib/ruby/gems/3.2.0/specifications/default/syntax_suggest-1.1.0.gemspec for gem syntax_suggest-1.1.0 === Detected gem syntax_suggest-1.1.0 (loaded, files) === 1 files, 111 bytes === Detected gem ocran-1.3.15 (loaded, files) === 6 files, 284024 bytes === Detected gem tk-0.5.0 (loaded, files) === 415 files, 2939900 bytes === Including 61 encoding support files (3775488 bytes, use --no-enc to exclude) C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/ocran-1.3.15/bin/ocran:84:in
+': no implicit conversion of nil into String (TypeError)The text was updated successfully, but these errors were encountered: