Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set a PyQtGraph GraphicView window to maximized state

I am trying to create a GraphicView() window to open in "maximized" state in order to fill the entire screen. But I didn't find so far any clue in PyQtGraph's documentation on how to do it

I managed to use resize(1420,820) to get it to work on my screen but I was wondering it was possible to use a keyword e.g. "maximized" to do it on any screen size.

import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui    

app = QtGui.QApplication([])

view = pg.GraphicsView()
layout = pg.GraphicsLayout()
view.setCentralItem(layout)

view.resize(1420,820)

view.show()

import sys
if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
    QtGui.QApplication.instance().exec_()

I am using Python on Windows 7.

like image 899
jmb_louis Avatar asked Sep 29 '14 09:09

jmb_louis


2 Answers

This is a Qt question, not specific to PyQtGraph. See:

  • http://doc.qt.io/qt-4.8/qwidget.html#showMaximized
  • http://doc.qt.io/qt-4.8/qwidget.html#setWindowState
like image 57
Luke Avatar answered Nov 05 '22 19:11

Luke


Thanks to Luke's answer, here is the working code:

import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui    

app = QtGui.QApplication([])

view = pg.GraphicsView()
layout = pg.GraphicsLayout()
view.setCentralItem(layout)

view.showMaximized()

import sys
if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
    QtGui.QApplication.instance().exec_()
like image 21
jmb_louis Avatar answered Nov 05 '22 18:11

jmb_louis