45 lines
908 B
Python
45 lines
908 B
Python
import sys
|
|
|
|
from PySide6.QtGui import QPainter
|
|
from PySide6.QtWidgets import (
|
|
QApplication,
|
|
QGraphicsScene,
|
|
QGraphicsView,
|
|
QHBoxLayout,
|
|
QWidget
|
|
)
|
|
|
|
from grid.ui.pattern import Pattern
|
|
|
|
class Window(QWidget):
|
|
|
|
def __init__(self):
|
|
super().__init__()
|
|
self.setWindowTitle("sphere grid")
|
|
self.setGeometry(0, 0, 600, 600)
|
|
|
|
self.scene = QGraphicsScene(0, 0, 600, 400)
|
|
|
|
pp = Pattern(200, 100)
|
|
#for wid in pp.content:
|
|
# self.scene.addItem(wid)
|
|
|
|
self.scene.addItem(pp)
|
|
|
|
# Define our layout.
|
|
hbox = QHBoxLayout()
|
|
|
|
view = QGraphicsView(self.scene)
|
|
view.setRenderHint(QPainter.RenderHint.Antialiasing)
|
|
|
|
vbox = QHBoxLayout(self)
|
|
vbox.addLayout(hbox)
|
|
vbox.addWidget(view)
|
|
|
|
self.setLayout(vbox)
|
|
self.show()
|
|
|
|
app = QApplication(sys.argv)
|
|
w = Window()
|
|
app.exec()
|