###前提・実現したいこと
Rubyでデスクトップマスコット(現時点では透過pngを画面に表示するだけ)の制作を目指しています。
できあがったプログラムをocraでexe化しようとすると
「`validate_arguments': Gio::Icon.hash: wrong number of arguments (0 for 1)」が発生します。
この問題を解決したいです。
###発生している問題・エラーメッセージ
Ruby
1=== Loading script to check dependencies 2=== Attempting to trigger autoload of Gem::ConfigFile 3=== Attempting to trigger autoload of Gem::DependencyList 4=== Attempting to trigger autoload of Gem::DependencyResolver 5=== Attempting to trigger autoload of Gem::Installer 6=== Attempting to trigger autoload of Gem::Licenses 7=== Attempting to trigger autoload of Gem::RequestSet 8=== Attempting to trigger autoload of Gem::Source 9=== Attempting to trigger autoload of Gem::SourceList 10=== Attempting to trigger autoload of Gem::SpecFetcher 11C:/Ruby23/lib/ruby/gems/2.3.0/gems/gobject-introspection-3.1.0-x86-mingw32/lib/gobject-introspection/loader.rb:640:in `validate_arguments': Gio::Icon.hash: wrong number of arguments (0 for 1) (ArgumentError) 12 from C:/Ruby23/lib/ruby/gems/2.3.0/gems/gobject-introspection-3.1.0-x86-mingw32/lib/gobject-introspection/loader.rb:589:in `build' 13 from C:/Ruby23/lib/ruby/gems/2.3.0/gems/gobject-introspection-3.1.0-x86-mingw32/lib/gobject-introspection/loader.rb:101:in `block in define_singleton_method' 14 from C:/Ruby23/lib/ruby/gems/2.3.0/gems/ocra-1.3.6/bin/ocra:470:in `block (2 levels) in attempt_load_autoload' 15 from C:/Ruby23/lib/ruby/gems/2.3.0/gems/ocra-1.3.6/bin/ocra:469:in `each' 16 from C:/Ruby23/lib/ruby/gems/2.3.0/gems/ocra-1.3.6/bin/ocra:469:in `block in attempt_load_autoload' 17 from C:/Ruby23/lib/ruby/gems/2.3.0/gems/ocra-1.3.6/bin/ocra:463:in `loop' 18 from C:/Ruby23/lib/ruby/gems/2.3.0/gems/ocra-1.3.6/bin/ocra:463:in `attempt_load_autoload' 19 from C:/Ruby23/lib/ruby/gems/2.3.0/gems/ocra-1.3.6/bin/ocra:715:in `build_exe' 20 from C:/Ruby23/lib/ruby/gems/2.3.0/gems/ocra-1.3.6/bin/ocra:1177:in `block in <top (required)>' 21
###該当のソースコード
Ruby
1require"gtk3" 2=begin 3これは背景が透明なウィンドウを表示して 4そこに画像を表示するプログラムです 5バツボタンが表示されないので、下のアイコンから閉じてください。 6動かすのに必要なもの 7・Ruby 8・gtk3 9・image.pngという名前の画像(6.のファイル名を変更するなら名前は何でもよい。) 10=end 11 12window = Gtk::Window.new #1.ウィンドウを作ります。 13 14 15window.signal_connect("destroy"){Gtk.main_quit} #2.ウィンドウがdestroyされたら終了。 16 17window.decorated = false #3.ウィンドウの枠を消します。trueにすると表示されます。 18 19window.keep_above = true #4.ウィンドウを常に最前面に表示するようにします。 20 21color = Gdk::RGBA::new(0, 0, 0, 0) #5.色を決めます。数値は0 ~ 1で設定します。数値の順番はRGBAでAが0なら他は何でもよいです。 22 23window.override_background_color(0, color) #6.ウィンドウの背景色を変更します。0にしないと背景色が変わりません。 24 25image = Gtk::Image.new(:file => "image.png") #7.画像を読み込みます。 26 27window.add(image) #8.ウィンドウに加えます。 28 29window.show_all #9.ウィンドウに載っているものをすべて表示します。 30 31Gtk.main #10.ループ
###試したこと
ここに書いてあることを参考にして書いてみました。
結果:undefined method `new_for_string' for Gio::Icon:Module (NoMethodError)が発生した。
ここを探してみましたが「Gio::Icon.hash」は見つかりませんでした。
ここを参考にプログラムを起動しないでexe化してみました。
結果:exe化はできたが「require : cannnot load such file -- gtk3(LoadError)」が発生して動かない。
Rubyのバージョンを変更してみました。Rubyは全て32bit版をRubyInstllerからダウンロードしました。
結果:2.0.0だとGTK3をダウンロードしているところでエラーが発生します。2.1.9, 2.2.6, 2.3.3はGTK3をダウンロードして上のプログラムを動かすことはできましたが、ocraを使うと同じエラーが発生します。
###補足情報(言語/FW/ツール等のバージョンなど)
ruby 2.3.1
gtk3 3.1.0
ocra 1.3.6
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。