From: Kouhei S. <ko...@co...> - 2016-11-12 06:53:03
|
Hi, In <919...@gm...> "[ruby-gnome2-devel-en] No Gdk::Window and Pixbuf not shown" on Fri, 11 Nov 2016 20:31:11 +0100, Detlef Wagner <det...@gm...> wrote: > First: > ====== > > require 'gtk3' > > win = Gtk::Window.new > > pixbuf = GdkPixbuf::Pixbuf.new :path => 'img.png', :width => 64, :height > => 64 > > img = Gtk::Image.new > img.pixbuf = pixbuf > #img = Gtk::Image.new :file => 'img.png' > > win.add img > win.show_all > Gtk.main You should use :file instead of :path for GdkPixbuf::Pixbuf.new: GdkPixbuf::Pixbuf.new :file => 'img.png' The API isn't changed at least in recent releases. > Second: > ======= > > require 'gtk3' > > win = Gtk::Window.new > win.signal_connect(:draw) do > p win.window.class > end > win.show_all > Gtk.main > > > The output is: > #<Class:0x00000001f5b9b8> > > but I belief that it should be: > Gdk::Window Try: win.signal_connect(:draw) do p win.window.class p win.window.class.gtype p win.window.class.ancestors end You'll get the following output: #<Class:0x0055ba4fe75b58> GLib::Type["GdkX11Window"] [#<Class:0x0055ba4fe75b58>, Gdk::Window, GLib::Object, GLib::Instantiatable, Object, Kernel, BasicObject] #<Class:0x0055ba4fe75b58> is a subclass of Gdk::Window. It depends on your windows system. This API isn't also changed at least in recent releases. > And then I have the problem, that configure events in combination with > Gtk::DrawingArea s are give not the right size of the area. But this is > in a quite complex program and I first try to track it down. If we have a script that reproduce the problem, we may fix it. > For me, it seams that the gtk API and ABI compatibility is brocken :-( We should fix unexpected API incompatibilities. Thanks, -- kou |