-
Notifications
You must be signed in to change notification settings - Fork 0
/
DamnCursor.py
88 lines (58 loc) · 2.25 KB
/
DamnCursor.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#from PyQt5.QtCore import *
#from PyQt5.QtGui import *
#from PyQt5.QtWidgets import *
from PyQt4.QtCore import *
from PyQt4.QtGui import *
if __name__ == '__main__':
import sys
app = QApplication(sys.argv)
desktop = QApplication.desktop()
availableGeometry=desktop.availableGeometry()
screenWidth=availableGeometry.width()
screenHeight=availableGeometry.height()
cursor=QCursor()
lastPos=QCursor.pos()
def checkCursorMoving():
global lastPos
currentPos=QCursor.pos()
print(lastPos,currentPos,lastPos==currentPos)
if lastPos==currentPos:
cursor.setPos(screenWidth,screenHeight)
lastPos=currentPos
timer = QTimer()
timer.timeout.connect(checkCursorMoving)
timer.start(10000)
def on_aboutDamnCursor_triggered():
describ = 'DamnCursor 让该死的光标滚一边去!!!'
QMessageBox.about(None, "关于 DamnCursor", describ)
def on_aboutMe_triggered():
describ = '''
<html>
<head/>
<body>
<p>
<span style=" font-size:10pt;">欢迎光临我的专页:</span>
<a href="http://imath.diandian.com">
<span style=" font-size:10pt; text-decoration: underline; color:#0000ff;">http://imath.diandian.com</span>
</a>
</p>
</body>
</html>
'''
QMessageBox.about(None, "关于我", describ)
def on_aboutQt_triggered():
QMessageBox.aboutQt(None)
quitAction =QAction("&Quit", None,triggered=qApp.quit)
aboutDamnCursorAction = QAction("about DamnCursor",None,triggered=on_aboutDamnCursor_triggered)
aboutAuthorAction = QAction("about Author",None,triggered=on_aboutMe_triggered)
aboutQtAction = QAction("about Qt",None,triggered=on_aboutQt_triggered)
trayIconMenu =QMenu()
trayIconMenu.addAction(aboutAuthorAction)
trayIconMenu.addAction(aboutQtAction)
trayIconMenu.addAction(aboutDamnCursorAction)
trayIconMenu.addAction(quitAction)
trayIcon = QSystemTrayIcon()
trayIcon.setContextMenu(trayIconMenu)
trayIcon.setIcon(QIcon('DamnCursor.png'))
trayIcon.show()
sys.exit(app.exec_())