aboutsummaryrefslogtreecommitdiffstats
path: root/doc/codesnippets/doc/src/snippets/code/src_opengl_qglcolormap.cpp
blob: 804741221a5f7aa2c909c95630acf4761d6408ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//! [0]
import sys

from PySide.QtGui import QApplication, qRgb
from PySide.QtOpenGL import QGLColormap

def main(argv):
    app = QApplication(argv)

    widget = MySuperGLWidget()     # a QGLWidget in color-index mode
    colormap = QGLColormap()

    # This will fill the colormap with colors ranging from
    # black to white.
    for i in range(0, colormap.size()):
        colormap.setEntry(i, qRgb(i, i, i))

    widget.setColormap(colormap)
    widget.show()
    return app.exec_()

if __name__ == "__main__":
    main(sys.argv)
//! [0]