forked from Jeij/gameofporcodio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
qtwidget_porco.py
66 lines (46 loc) · 1.65 KB
/
qtwidget_porco.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
import sys
from PyQt4 import QtGui, QtCore
class porcoWidget(QtGui.QWidget):
def __init__(self):
super(porcoWidget, self).__init__()
self.initUI()
def initUI(self):
#Actions
porcodioAction = QtGui.QAction(QtGui.QIcon('farm6.png'), '&Dio', self)
porcodioAction.setStatusTip('Bestemmiare Aiuta')
#BUTTONS
btn1 = QtGui.QPushButton('porco dio!', self)
btn1.setToolTip('<i> Bestemmiare Aiuta </i>')
btn2 = QtGui.QPushButton('dio porco', self)
btn2.setToolTip('<i> Bestemmiare Aiuta sempre di piu\' </i>')
#LABEL
lbl1 = QtGui.QLabel('ZetCode', self)
lbl1.move(15, 10)
#LAYOUT
hbox = QtGui.QHBoxLayout()
hbox.addStretch(1)
hbox.addWidget(btn1)
hbox.addWidget(btn2)
vbox = QtGui.QVBoxLayout()
vbox.addStretch(1)
vbox.addLayout(hbox)
self.setLayout(vbox)
#Label absolute position
QtGui.QToolTip.setFont(QtGui.QFont('SansSerif', 10))
self.setToolTip('This is a <b>Game Of Life Widget</b>')
self.setGeometry(0, 0, 250, 150)
self.setWindowTitle('Porco')
self.show()
#centra la finestra principale al centro dello schermo
def center(self):
qr = self.frameGeometry()
cp = QtGui.QDesktopWidget().availableGeometry().center()
print 'cp '+str(cp)
qr.moveCenter(cp)
self.move(qr.topLeft())
def main():
app = QtGui.QApplication(sys.argv)
ex = porcoWidget()
sys.exit(app.exec_())
if __name__ == '__main__':
main()