forked from harry159821/XiamiForLinuxProject
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathguessYouLike.py
73 lines (66 loc) · 2.27 KB
/
guessYouLike.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
#!/usr/bin/python
# -*- coding:utf-8 -*-
import sys
from PyQt4 import QtGui,QtCore,Qt
class guessYouLike(QtGui.QWidget):
def __init__(self,parent=None):
super(guessYouLike,self).__init__()
self.playOrPauseBtn = QtGui.QCheckBox()
self.playOrPauseBtn.setParent(self)
self.playOrPauseBtn.setObjectName('playOrPauseBtn')
self.playOrPauseBtn.move(self.size().width()/2,self.size().height()/2)
self.setStyleSheet('''
/*播放与暂停*/
QCheckBox#playOrPauseBtn::indicator
{
width: 50px;
height: 50px;
}
QCheckBox#playOrPauseBtn
{
min-width: 50px;
max-width: 50px;
min-height: 50px;
max-width: 50px;
qproperty-text: "";
}
/*播放*/
QCheckBox#playOrPauseBtn::indicator:unchecked
{
image:url("img/guessYouLike/guess_you_like_play_normal.tiff");
}
QCheckBox#playOrPauseBtn::indicator:unchecked:hover
{
image:url("img/guessYouLike/guess_you_like_play_hover.tiff");
}
QCheckBox#playOrPauseBtn::indicator:unchecked:pressed
{
image:url("img/guessYouLike/guess_you_like_play_down.tiff");
}
/*暂停*/
QCheckBox#playOrPauseBtn::indicator::checked
{
image:url("img/guessYouLike/guess_you_like_pause_normal.tiff");
}
QCheckBox#playOrPauseBtn::indicator::checked:hover
{
image:url("img/guessYouLike/guess_you_like_pause_hover.tiff");
}
QCheckBox#playOrPauseBtn::indicator::checked:pressed
{
image:url("img/guessYouLike/guess_you_like_pause_down.tiff");
}
''')
def enterEvent(self,event):
self.setCursor(QtCore.Qt.ArrowCursor)
def resizeEvent(self,event):
self.playOrPauseBtn.move(self.size().width()/2,self.size().height()/2)
def paintEvent(self,event):
# 窗口阴影
p = QtGui.QPainter(self)
p.drawPixmap(0, 0, self.rect().width(), self.rect().height(), QtGui.QPixmap('img/guessYouLike/guess_you_like_bg.png'))
if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
w = guessYouLike()
w.show()
sys.exit(app.exec_())