RuntimeWarning: PyOS_InputHook is not available for interactive use by PyGTK
1 answer
When does it work? Are you trying to run multiple script or are you just using PyGTK interactively?
Most likely your input hook is being captured by another interactive loop, like:
>>> import Tkinter
>>> root = Tkinter.Tk() # input hook is grabbed by Tkinter for immediate result evaluation
>>> import gtk # gtk tries to grab the hook, but fails
/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:127: RuntimeWarning: PyOS_InputHook is not available for interactive use of PyGTK
Evaluating the result directly means that the results of the expression are evaluated immediately (like a window) before entering the main loop.
Keep in mind that this is a warning, not a bug, but if it bothers you, you can import the gtk module as early as possible (or, well, early enough) and drop the input hook:
import gtk
gtk.set_interactive(False)
import Tkinter
root = Tkinter.Tk()
# no warning here
+2
source to share