It's a tiny simple code.
In this code, self.showMaximized() is not working.
And even it's so tiny, I don't know why.
import sys
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
class Window(QWindow):
def __init__(self):
QWindow.__init__(self)
self.setTitle("title")
self.showMaximized()
# self.resize(400,300)
# self.showMaximized()
# self.showFullScreen()
app = QApplication(sys.argv)
screen = Window()
screen.show()
sys.exit(app.exec_())
Delete 'screen.show()', and then showMaximized() worked.
Either you need to use .showMaximized()
only on newly created Object
i.e., screen
, but not in your constructor or only at the end of your constructor, but not twice.
Code:
import sys
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
class Window(QWindow):
def __init__(self):
QWindow.__init__(self)
self.setTitle("title")
app = QApplication(sys.argv)
screen = Window()
screen.showMaximized()
sys.exit(app.exec_())