0

I have a Python/pygI program which shows a window with buttons with various characters, primarily the ones that are not found on standard keyboard. (€æÜÄØá¿ etc)

And I have, say, Gedit open. I have made my program's window unfocusable, so the Gedit's window remains in focus when I press a button in my program's window.

My problem is: when I press a button with a character in my program's window, I want it to be automatically typed into Gedit's window. So it's some kind of an auxiliary on-screen keyboard with rare symbols.

My current method of doing it is via clipboard, but it's tedious because

  • it contaminates the clipboard
  • I have to Ctrl+V every time to put the symbol into Gedit.

Is there a way to put a symbol into an active window from Python program? Maybe I should use some Linux utilities via subprocessing? Maybe there is even a way to do it via means of Gtk? Or maybe I can manipulate the clipboard somehow so it would put a character there, automatically paste it to Gedit and put the original clipboard contents back?

EDIT1: I am using X window system in Ubuntu 14.04.

Highstaker
  • 1,015
  • 2
  • 12
  • 28
  • Possible duplicate of [Generate keyboard events](http://stackoverflow.com/questions/13564851/generate-keyboard-events) – GingerPlusPlus Feb 05 '16 at 11:03
  • @GingerPlusPlus That question (rather, the answers) is primarily about Windows, and I am concerned about X in Ubuntu. Also, not sure if I can make a keyboard event into untypeable character. – Highstaker Feb 05 '16 at 11:10
  • 1
    For gedit specifically, it might be possible to add a character using DBus. – elya5 Feb 05 '16 at 14:43
  • @elya5 Thanks! I'll look into it. Yet, I'm looking for a global app-independent solution. – Highstaker Feb 11 '16 at 10:56

0 Answers0