GRID_SIZE = 3
# Create our board of 9 buttons and put them in a grid
for i in range(0, GRID_SIZE ):
for j in range(0, GRID_SIZE ):
self.button[i][j].setMinimumSize(25, 25)
self.button[i][j].setMaximumSize(25, 25)
grid.addWidget(self.button[i][j], i, j)
vbox.addLayout(grid)
# Add the warnings label
vbox.addWidget(self.labelWarn)
vbox.addStretch(0)
hbox.addLayout(vbox)
hbox.addStretch(0)
self.setLayout(hbox)
self.button[0][0].clicked.connect(lambda: self.on_button_clicked(0, 0))
self.button[0][1].clicked.connect(lambda: self.on_button_clicked(0, 1))
self.button[0][2].clicked.connect(lambda: self.on_button_clicked(0, 2))
self.button[1][0].clicked.connect(lambda: self.on_button_clicked(1, 0))
self.button[1][1].clicked.connect(lambda: self.on_button_clicked(1, 1))
self.button[1][2].clicked.connect(lambda: self.on_button_clicked(1, 2))
self.button[2][0].clicked.connect(lambda: self.on_button_clicked(2, 0))
self.button[2][1].clicked.connect(lambda: self.on_button_clicked(2, 1))
self.button[2][2].clicked.connect(lambda: self.on_button_clicked(2, 2))
GRID_SIZE = 3
# Create our board of 9 buttons and put them in a grid
for i in range(0, GRID_SIZE ):
for j in range(0, GRID_SIZE ):
self.button[i][j] = QPushButton()
self.button[i][j].setMinimumSize(25, 25)
self.button[i][j].setMaximumSize(25, 25)
grid.addWidget(self.button[i][j], i, j)
vbox.addLayout(grid)
# Add the warnings label
vbox.addWidget(self.labelWarn)
vbox.addStretch(0)
hbox.addLayout(vbox)
hbox.addStretch(0)
self.setLayout(hbox)
self.button[0][0].clicked.connect(lambda: self.on_button_clicked(0, 0))
self.button[0][1].clicked.connect(lambda: self.on_button_clicked(0, 1))
self.button[0][2].clicked.connect(lambda: self.on_button_clicked(0, 2))
self.button[1][0].clicked.connect(lambda: self.on_button_clicked(1, 0))
self.button[1][1].clicked.connect(lambda: self.on_button_clicked(1, 1))
self.button[1][2].clicked.connect(lambda: self.on_button_clicked(1, 2))
self.button[2][0].clicked.connect(lambda: self.on_button_clicked(2, 0))
self.button[2][1].clicked.connect(lambda: self.on_button_clicked(2, 1))
self.button[2][2].clicked.connect(lambda: self.on_button_clicked(2, 2))
To copy to clipboard, switch view to plain text mode
Bookmarks