Re: Missing object method: new_from_file_at_size

Unfortunately new_from_file() doesn't work either :( It seems like *nothing* from Gtk::Gdk has bindings in Windows.

What *does* work is:

$self->{icons}->{CONNECTION} = Gtk3::Image->new_from_file( $icon_folder . "/connection.png" )->get_pixbuf;

I don't immediately see how to scale the image, but it's something I can work around ... possibly by pre-rendering the images at the desired size.


On Wed, Oct 22, 2014 at 5:19 AM, Torsten Schoenfeld <kaffeetisch gmx de> wrote:
On 20.10.2014 13:56, Daniel Kasak wrote:
> *** unhandled exception in callback:
> ***   Can't locate object method "new_from_file_at_size" via package
> "Gtk3::Gdk::Pixbuf" at window/ <> line 84.
> ***  ignoring at C:/strawberry/perl/site/lib/ line 318.

Weird.  As you say, it works fine on Linux:

# perl -MGtk3=-init -E'say Gtk3::Gdk::Pixbuf->new_from_file_at_size
("/usr/share/icons/Humanity/actions/24/gtk-ok.svg", 24, 24)'

Do you still have the GdkPixbuf-2.0.gir from which GdkPixbuf-2.0.typelib
was generated?  It should contain an entry akin to this:

      <constructor name="new_from_file_at_size"
        <doc xml:space="preserve">...</doc>
        <return-value transfer-ownership="full">
          <doc xml:space="preserve">...</doc>
          <type name="Pixbuf" c:type="GdkPixbuf*"/>
          <parameter name="filename" transfer-ownership="none">
            <doc xml:space="preserve">Name of file to load, in the GLib
file name encoding</doc>
            <type name="utf8" c:type="const char*"/>
          <parameter name="width" transfer-ownership="none">
            <doc xml:space="preserve">The width the image should have or
-1 to not constrain the width</doc>
            <type name="gint" c:type="int"/>
          <parameter name="height" transfer-ownership="none">
            <doc xml:space="preserve">The height the image should have
or -1 to not constrain the height</doc>
            <type name="gint" c:type="int"/>

To work around the missing binding, try to use new_from_file_at_scale()
or simply new_from_file() and scale_simple().
gtk-perl-list mailing list
gtk-perl-list gnome org

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]