GLViewWidget Viewport Size

140 views
Skip to first unread message

deepsy...@gmail.com

unread,
Jul 10, 2017, 4:52:16 AM7/10/17
to pyqtgraph
I am unable to set viewport to desired dimensions. Despite specifying (1980 x 1080), the resultant dimensions are (1366 x 855). The 3D examples in pyqtgraph too do not show full screen and are located at lower left corner only.

import pyqtgraph.opengl as gl
from PyQt5 import QtWidgets
from pyqtgraph.Qt import QtCore    

app
= QtWidgets.QApplication([])

view
= gl.GLViewWidget()
view
.opts['viewport'] =  (0, 0, 1920, 1080)
view
.showMaximized()

view
.setMaximumSize(1920, 1080)
print ("%d %d" % (view.height() ,  view.width()))
view
.setWindowTitle('3D Matrix Visualization')


## create three grids, add each to the view
xgrid
= gl.GLGridItem()
ygrid
= gl.GLGridItem()
zgrid
= gl.GLGridItem()
view
.addItem(xgrid)
view
.addItem(ygrid)
view
.addItem(zgrid)

## rotate x and y grids to face the correct direction
xgrid
.rotate(90, 0, 1, 0)
ygrid
.rotate(90, 1, 0, 0)

## scale each grid differently
xgrid
.scale(0.2, 0.1, 0.1)
ygrid
.scale(0.2, 0.1, 0.1)
zgrid
.scale(0.1, 0.2, 0.1)


deepsy...@gmail.com

unread,
Jul 10, 2017, 7:18:07 PM7/10/17
to pyqtgraph
If I run the code without changing viewport settings, the parent window, by the virtue of showMaximized(), appears full screen. But the drawable area is confined to 1/4 of the screen in the lower left corner. 

view.opts['viewport'] =  (0, 0, 1920, 1080)

Using above code, does make drawable area larger but then it is not large enough to cover maximized screen. It is 1366x855. The grid/axis appears in upper right corner and not in the center of 1366x855. In the default mode, the grid/axis appears in the center of the 1/4 drawable area.

Any help is appreciated.
Reply all
Reply to author
Forward
0 new messages