Sebastien Aubry schrieb:
Hello,
The documentation about Plugs and Sockets did not allow me to find out
whether they can be used to embed anything:
- can they only be used to embed PyGtk widgets into another PyGtk window?
- or can I embed anything using plugs and sockets ?
You can embed any X window object into a gtk.Socket _if_ and only if you
have the window's xwindow id. Take a look at the example in the pygtk
tutorial! To embed an xterm:
1) start the xterm
2) execute "xwininfo". The mouse cursor will change to a crosshair.
Select the xterm. The window information is displayed, e.g.
xwininfo: Window id: 0x1a0000e "xterm"
Absolute upper-left X: 5
Absolute upper-left Y: 649
Relative upper-left X: 5
Relative upper-left Y: 21
Width: 484
Height: 316
Depth: 24
Visual Class: TrueColor
Border width: 0
Class: InputOutput
Colormap: 0x20 (installed)
Bit Gravity State: NorthWestGravity
Window Gravity State: NorthWestGravity
Backing Store State: NotUseful
Save Under State: no
Map State: IsViewable
Override Redirect State: no
Corners: +5+649 -791+649 -791-59 +5-59
-geometry 80x24+0-54
3) Now call socket.py with the given window id. A hex number on the
command line would be misinterpreted by socket.py, so you need to
convert the hex number beforehand, e.g. by calling long(windowid) in the
python shell.
>>> long(0x1a0000e)
27262990L
Now on the command line
$ python socket.py 27262990
Finished! The xterm is now reparented.
So in principle, you can steal any window as long as you have its window
id. Unfortunately I don't really know how to get this id from a Tkinter
widget (the xwininfo method is not so thrilling).
The next thing you will notice is that you can't type anything in the
embedded xterm window. I believe this is only because the parent window
steals the keyboard focus. I have used the plug/socket mechanism myself
to embed a gnuplot window and I know that keyboard and mouse interaction
worked for that.
Regards,
Niklas.
A simple example of embedding an xterm (or a Tkinter window) as a widget
inside a PyGtk window would be appreciated.
Regards.
Sébastien Aubry
------------------------------------------------------------------------
_______________________________________________
pygtk mailing list pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
_______________________________________________
pygtk mailing list pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/