forked from eladj/QtCards
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
62 lines (49 loc) · 1.94 KB
/
main.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
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import cardstable
import random
class CardTableWidgetExtend(cardstable.cardTableWidget):
""" extension of CardTableWidget """
def __init__(self):
super(CardTableWidgetExtend, self).__init__()
class MainWindow(QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
# create widgets
self.label1 = QLabel("Bla Bla")
self.label1.setFont(QFont('Andalus', 24))
self.label1.setAlignment(Qt.AlignCenter)
self.label1.setMaximumHeight(30)
self.label1.setStyleSheet("QLabel { background-color : blue; color : white; font: bold }")
self.cardsTable = CardTableWidgetExtend()
# main layout
self.mainLayout = QVBoxLayout()
# add all widgets to the main vLayout
self.mainLayout.addWidget(self.label1)
self.mainLayout.addWidget(self.cardsTable)
# central widget
self.centralWidget = QWidget()
self.centralWidget.setLayout(self.mainLayout)
#
# # set central widget
self.setCentralWidget(self.centralWidget)
# PLAYGROUND
self.cardsTable.dealDeck()
#self.cardsTable.addCard('c_K')
#self.cardsTable.getCardsList()[0].setPos(0,0)
# self.cardsTable.addCard('d_8')
# self.cardsTable.addCard('j_r')
# self.cardsTable.changeCard(1,'h_J', faceDown=True)
# self.cardsTable.removeCard(51)
self.cardsTable.getCardsList()
# self.cardsTable.deal1()
if __name__ == "__main__":
app = QApplication(sys.argv)
widget = MainWindow()
widget.setWindowTitle("My Title")
widget.setWindowIcon(QIcon('icon.png'))
widget.show()
sys.exit(app.exec_())