Hi there, I am trying to get my script to register a global hotkey (or "accel" key, should I rather say) under KDE 3.4.3. I am using KGlobalAccel, but without any success. All that I have achieved so far is either: - freezing the app (and the keyboard, globally!) after I hit the accel key; - crashing the app when I hit the accel key; - or some other similar nice behaviour. (the code provided below)
I must point out, though, that I am quite new to Python, and a total noob to programming GUI apps in it. Any help/pointers appreciated. Cheers Mike P.S. The code I use is: #!/usr/bin/python import sys import time from kdecore import * from qt import * from kdeui import KMainWindow # the tester def tester(): print '=== TESTER === TESTER === TESTER ===' pass class MainWin (KMainWindow): def __init__ (self, *args): apply (KMainWindow.__init__, (self,) + args) # create the hotkey object print 'start' shortcut = KShortcut('F11') if shortcut == None: print 'no, sir!' else: print shortcut.toString() accelObject = KGlobalAccel(self) accelObject.insert("Tester", "Tester AccelKey", "A tester accel key", shortcut, shortcut, tester) accelObject.updateConnections() pass appName = "tester" app = KApplication (sys.argv, appName) mainWindow = MainWin (None, "main window") app.exec_loop() Send instant messages to your online friends http://uk.messenger.yahoo.com _______________________________________________ PyKDE mailing list PyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde