# GTK xwindows id

**URL:** <https://www.ruby-forum.com/t/gtk-xwindows-id/107401>\
**Category:** Ruby-Gnome 2\
**Created:** [June 21, 2007, 10:45am UTC](https://www.ruby-forum.com/t/gtk-xwindows-id/107401 "2007-06-21T10:45:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Erwan\_Masson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/e36b37/32.png) [@Erwan\_Masson](https://www.ruby-forum.com/u/Erwan_Masson)\
**Post date:** [June 21, 2007, 10:45am UTC](https://www.ruby-forum.com/t/gtk-xwindows-id/107401/1 "2007-06-21T10:45:40Z")

</div>

Hello,  
I would like to grab the x windows id to a GTK Drawing Area object. I  
have  
seen that is possible to do that easily in python, but I am not be able  
to  
retrieve this info on ruby.  
In Python I can grab like this : myDrawingAreaObject.window.xid  
Can somone has an idea please?  
Thanks for help,  
Erwan Masson

---

<div class="post-metadata">

**Author:** ![Erwan\_Masson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/e36b37/32.png) [@Erwan\_Masson](https://www.ruby-forum.com/u/Erwan_Masson)\
**Post date:** [June 21, 2007, 5:05pm UTC](https://www.ruby-forum.com/t/gtk-xwindows-id/107401/2 "2007-06-21T17:05:46Z")

</div>

Hi,

On Thu, 21 Jun 2007 10:45:13 +0200  
“Erwan Masson” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hello,  
> I would like to grab the x windows id to a GTK Drawing Area object. I have  
> seen that is possible to do that easily in python, but I am not be able to  
> retrieve this info on ruby.  
> In Python I can grab like this : myDrawingAreaObject.window.xid  
> Can somone has an idea please?

If you compile Ruby-GNOME2 on X11(not Windows), there is a  
Gdk::Drawable#xid.

Here is a sample:

require ‘gtk2’  
win = Gtk::Window.new  
draw = Gtk::DrawingArea.new  
win.add draw  
win.show\_all # or realize draw.  
p draw.window.xid

* * *

This [SF.net](http://SF.net) email is sponsored by DB2 Express  
Download DB2 Express C - the FREE version of DB2 express and take  
control of your XML. No limits. Just data. Click to get it now.  
[http://sourceforge.net/powerbar/db2/](http://sourceforge.net/powerbar/db2/)
