Reputation: 326
I'm currently developing a language transition software for linux using python GTK. it has two entries. what it basically does is, when the user type some word in a text entry 1, the translated text appears in text entry 2 and when the user press space bar, I want to paste the translated text to another application's text area. not to a text entry in my application. I think it needs to switch to the other application, paste the text and switch back to my application.
As an example, if gedit is opened in background, when a user type a word in my application and press the space bar, the translated word should be pasted in gedit.
Sometimes it may be possible to complete my task by set my application window as a popup window(type=WINDOW_POPUP) without set it as top level window(type=WINDOW_TOPLEVEL). but I'm not clear with that.
I think the problem is clear to you. If anyone can help me to solve this problem, it would be a great help for me. Thanks all.
Upvotes: 1
Views: 1724
Reputation: 15266
this looks like a dbus solution and not a fun one. As for clipboard manipulation in GTK http://developer.gnome.org/gtk3/stable/gtk3-Clipboards.html will get you where you need to go, most of the C functions have a direct equivalent in python ( http://developer.gnome.org/pygtk/stable/class-gtkclipboard.html ). Communication between applications in GTK+ is not a whole lot of fun and when I worked on a project that had to do so, I ended up using DBUS (C++) but there might be a good python port for dbus, I haven't checked.
Upvotes: 1