If you can intercept the event raised by the key, press and call a specific function, than you could do this:
def prompt(): import code code.interact(local=locals())
or if you are using IPython:
def prompt(): from IPython.Shell import IPShellEmbed ipshell = IPShellEmbed() ipshell(local_ns=locals())
This will open a python or IPython shell in which you can access the current environment.
Greetings Andrea
nivox source share