How to put a KDE application inside a Tkinter window ?

Sean 'Shaleh' Perry shalehperry at attbi.com
Fri Oct 4 13:03:27 EDT 2002


On Friday 04 October 2002 09:48, Michele Simionato wrote:
> I discovered from a posting in c.l.p., that it is possible to put an
> X-Window application inside a Tkinter window by using a BLT container. For
> instance the following code insert an xclock inside a Tkinter window:
>
> ----
>
> # works if the BLT library is installed
> import os; from Tkinter import *
>
> name="xclock"
> t = Tk()
> t.tk.call("package", "require", "BLT")
> os.system(name+" &")
> c = Widget(t,'blt::container')
> c.pack(fill="both", expand="yes")
> c.configure(relief="raised", name=name)
> t.mainloop()
>
> ----
>
> However, the previous code doesn't work for KDE applications, in the sense
> that the application is open but outside the Tkinter window. I would like
> to put the KDE mp3 player "noatun" inside a Tkinter window. How can I do
> that ? Suggestions are welcome.

The way this code works is blt::container looks for existing X Windows which 
have the WM_CLASS set to name.  If 3 xclocks are running your script will get 
confused.  This is the problem with KDE apps, they have multiple windows for 
their application and btl::container does not know how to deal with it.

This style of containment does not work so well with 3rd party programs.




More information about the Python-list mailing list