When I try to run this, it starts and runs perfectly fine with no error and a white screen just like any other normal PySide6 program but it doesn't show the text that i expected to see.
from PySide6.QtWidgets import *
from PySide6.QtCore import *
from PySide6.QtGui import *
class View(QGraphicsScene):
def __init__(self):
super().__init__()
self.addText("Hello!")
self.scene = QGraphicsView(self)
self.scene.show()
app = QApplication([])
View()
app.exec()
i expected a white screen with hello text but there's just a white screen with nothing
You are not doing assigning View
object to any variable, so it gets garbage collected nearly immediately. Assign it to something and it will stay open: window = View()