Re: Scaling an image with Gtk2::Gdk::Pixbuf->scale



>The event box can then be added to the textview widget.
 
How, exactly?
 
We have Gtk2::TextBuffer->insert for inserting text, Gtk2::TextBuffer->insert_pixbuf for inserting pixbufs, but no equivalent method for inserting an event box (something like Gtk2::TextBuffer->insert_event_box ).
 
Perhaps you meant: put the pixbuf in an event box, ->insert_pixbuf as before, and monitor signals for the event box. Something like:
 
    $pixbuf = Gtk2::Gdk::Pixbuf->new_from_file($path);
    $image = Gtk2::Image->new_from_pixbuf($pixbuf);
    $ebox = Gtk2::EventBox->new();
    $ebox->add($image);
 
    $buffer = $textView->get_buffer();
    $buffer->insert_pixbuf(
        $buffer->get_end_iter(),
        $pixbuf,
    );
 
    ...
 
   $ebox->signal_connect(motion_notify_event => sub {
 
        # Some stuff here
    });
 
...but that doesn't seem to be the right approach, either.
 
 


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