<filename>src/background.py
# Copyright (C) 2022 viraelin
# License: MIT

from PyQt6.QtCore import *
from PyQt6.QtWidgets import *
from PyQt6.QtGui import *


class Background(QGraphicsRectItem):

    def __init__(self) -> None:
        super().__init__()
        self.setZValue(-1000)

        size = 800000
        size_half = size / 2
        rect = QRectF(-size_half, -size_half, size, size)
        self.setRect(rect)

        xp1 = QPoint(-size, 0)
        xp2 = QPoint(size, 0)
        self._line_x = QLine(xp1, xp2)

        yp1 = QPoint(0, -size)
        yp2 = QPoint(0, size)
        self._line_y = QLine(yp1, yp2)

        self._axis_color = QColor("#111111")
        self._pen = QPen()
        self._pen.setColor(self._axis_color)
        self._pen.setWidth(4)
        self._pen.setCosmetic(True)
        self._pen.setStyle(Qt.PenStyle.SolidLine)
        self._pen.setCapStyle(Qt.PenCapStyle.SquareCap)
        self._pen.setJoinStyle(Qt.PenJoinStyle.MiterJoin)
        self._background_color = QColor("#222222")
        self._brush = QBrush()
        self._brush.setColor(self._background_color)
        self._brush.setStyle(Qt.BrushStyle.SolidPattern)


    def paint(self, painter: QPainter, option: QStyleOptionGraphicsItem, widget: QWidget) -> None:
        painter.setPen(self._pen)
        painter.setBrush(self._brush)

        painter.drawRect(self.rect())
        painter.drawLine(self._line_x)
        painter.drawLine(self._line_y)

<filename>src/background.py
# Copyright (C) 2022 viraelin
# License: MIT

from PyQt6.QtCore import *
from PyQt6.QtWidgets import *
from PyQt6.QtGui import *


class Background(QGraphicsRectItem):

    def __init__(self) -> None:
        super().__init__()
        self.setZValue(-1000)

        size = 800000
        size_half = size / 2
        rect = QRectF(-size_half, -size_half, size, size)
        self.setRect(rect)

        xp1 = QPoint(-size, 0)
        xp2 = QPoint(size, 0)
        self._line_x = QLine(xp1, xp2)

        yp1 = QPoint(0, -size)
        yp2 = QPoint(0, size)
        self._line_y = QLine(yp1, yp2)

        self._axis_color = QColor("#111111")
        self._pen = QPen()
        self._pen.setColor(self._axis_color)
        self._pen.setWidth(4)
        self._pen.setCosmetic(True)
        self._pen.setStyle(Qt.PenStyle.SolidLine)
        self._pen.setCapStyle(Qt.PenCapStyle.SquareCap)
        self._pen.setJoinStyle(Qt.PenJoinStyle.MiterJoin)
        self._background_color = QColor("#222222")
        self._brush = QBrush()
        self._brush.setColor(self._background_color)
        self._brush.setStyle(Qt.BrushStyle.SolidPattern)


    def paint(self, painter: QPainter, option: QStyleOptionGraphicsItem, widget: QWidget) -> None:
        painter.setPen(self._pen)
        painter.setBrush(self._brush)

        painter.drawRect(self.rect())
        painter.drawLine(self._line_x)
        painter.drawLine(self._line_y)

# Copyright (C) 2022 viraelin # License: MIT