I am attempting to open a window on mouse activity which works, but the window fails to stay open. I set it to terminate when the escape key is pressed even when the program is not currently selected. This works fine. Originally I had it create the window only with a right click, but when I noticed the window closed immediately I set it to any mouse activity for easier debugging. My script is as follows: [code] import pythoncom, pyHook import sys import win32api from PyQt4 import QtGui, QtCore
class WindowObject(QtGui.QWidget): def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.setWindowTitle('Window') self.resize(50, 250) def OnKeyboardEvent(event): if event.KeyID == 27: win32api.PostQuitMessage() return 1 def OnMouseEvent(event): x = event.Position[0] y = event.Position[1] createWindow(x, y) return 1 def createWindow(x, y): menu = WindowObject() menu.move(x, y) menu.show() hm = pyHook.HookManager() hm.MouseAll = OnMouseEvent hm.KeyDown = OnKeyboardEvent hm.HookMouse() hm.HookKeyboard() app = QtGui.QApplication(sys.argv) pythoncom.PumpMessages()[/code] I'm fairly certain that this is due to my lack of understanding in the PumpMessages command and the HookManager. Any advice? -- http://mail.python.org/mailman/listinfo/python-list