/usr/share/doc/python-qwt3d-doc/qt4examples/ParametricSurfaceDemo.py is in python-qwt3d-doc 0.1.7~cvs20090625-13build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | #!/usr/bin/env python
import sys
from math import cos, pi, sin
from PyQt4.Qt import QApplication, QCoreApplication, QFont, QFontDatabase, Qt
from PyQt4.Qwt3D import ParametricSurface, RGBA, SurfacePlot, Triple, NOCOORD
class Sphere(ParametricSurface):
def __init__(self, *args):
ParametricSurface.__init__(self, *args)
self.setMesh(41, 31)
self.setDomain(0, 2*pi, 0, pi)
self.setPeriodic(False, False)
# __init__()
def __call__(self, u, v):
r = 1.0
return Triple(r*cos(u)*sin(v), r*sin(u)*sin(v), r*cos(v))
# __call__()
# class Sphere
class Plot(SurfacePlot):
def __init__(self, *args):
SurfacePlot.__init__(self, *args)
# fonts
family = QCoreApplication.instance().font().family()
if 'Verdana' in QFontDatabase().families():
family = 'Verdana'
family = 'Courier'
self.setTitleFont(family, 16, QFont.Bold)
## self.setTitleColor(RGBA(1.0, 0.0, 0.0))
self.setTitle("A Simple Parametric Surface Demonstration")
self.setBackgroundColor(RGBA(1.0, 1.0, 0.6))
sphere = Sphere(self)
sphere.create()
self.setRotation(45, 15, 0)
self.setCoordinateStyle(NOCOORD);
self.updateData()
self.updateGL()
# __init__()
# class Plot
def make():
demo = Plot()
demo.show()
# Matrox cards on Linux work better with a resize() after show()
demo.resize(600, 400)
return demo
# make()
def main(args):
app = QApplication(args)
demo = make()
app.exec_()
# main()
# Admire
if __name__ == '__main__':
main(sys.argv)
# Local Variables: ***
# mode: python ***
# End: ***
|