# Copy/Paste via EventBox (and an image)

**URL:** <https://www.ruby-forum.com/t/copy-paste-via-eventbox-and-an-image/210911>\
**Category:** Ruby-Gnome 2\
**Created:** [August 20, 2011, 12:22pm UTC](https://www.ruby-forum.com/t/copy-paste-via-eventbox-and-an-image/210911 "2011-08-20T12:22:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [August 20, 2011, 12:22pm UTC](https://www.ruby-forum.com/t/copy-paste-via-eventbox-and-an-image/210911/1 "2011-08-20T12:22:30Z")

</div>

Let’s say I have an image. I put this into an EventBox.

image = Gtk::Image.new  
eventbox = Gtk::EventBox.new  
eventbox.add image

Now when I want to click on this image, I want to assign the clipboard  
to the string:

“This is a test”

And then I want to be able to paste this to other widgets and also into  
a console. As if I would have selected this text with my mouse button  
(on Linux)

How is this doable?

I am playing around with .get\_clipboard(Gdk::Selection::CLIPBOARD) right  
now but somehow I can’t paste into other widgets, yet alone into the  
console.
