class QS(QtWidgets.QGraphicsScene):

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
width = Settings.NUM_BLOCKS_X * Settings.WIDTH
height = Settings.NUM_BLOCKS_Y * Settings.HEIGHT
self.setSceneRect(0, 0, width, height)
self.setItemIndexMethod(QtWidgets.QGraphicsScene.NoIndex)
for x in range(0, Settings.NUM_BLOCKS_X + 1):
    xc = x * Settings.WIDTH
self.addLine(xc, 0, xc, height)
for y in range(0, Settings.NUM_BLOCKS_Y + 1):
    yc = y * Settings.HEIGHT
self.addLine(0, yc, width, yc)
How to draw a proper grid on PyQt?