This simple key logger shows any character/special key when pressed.

show any character/special key when pressed
using Tkinter

    # Python2
    import Tkinter as tk
except ImportError:
    # Python3
    import tkinter as tk

def show_key(event):
    '''show event.keycode, event.keysym, event.char results'''
    if event.char == event.keysym:
        msg = 'Normal Key %r' % event.char
    elif len(event.char) == 1:
        msg = 'Punctuation Key %r (%r)' % (event.keysym, event.char)
        msg = 'Special Key %r' % event.keysym
    if event.keysym == 'Escape':

root = tk.Tk()
print("Press a key (Escape key to exit): ")
root.bind_all('<Key>', show_key)
# don't show the tk window

And the purpose of this is? Keyloggers can be used to build a remote-control support application (I have done so in the past, and that is what VNC and other RC applications do), or it can be used for nefarious purposes. In any case, it can be a dangerous path to provide for those who don't know how to pwn systems already... :-(

I don't think this is that type of keylogger.

Thank's a lot!
That was exactly what I needed.
The only issue I havn't discovered is, why it doesn't work on my RasPi
if I hide the root-window via root.withdraw. If I show it, the code works properly.

some ideas?

best regards