|
From: <hba...@us...> - 2009-07-02 17:05:22
|
Revision: 10110
http://plplot.svn.sourceforge.net/plplot/?rev=10110&view=rev
Author: hbabcock
Date: 2009-07-02 17:05:19 +0000 (Thu, 02 Jul 2009)
Log Message:
-----------
Rename and touch up the (still very simple) PyQt4 example.
Modified Paths:
--------------
trunk/examples/python/CMakeLists.txt
Added Paths:
-----------
trunk/examples/python/pyqt4_example.py
Modified: trunk/examples/python/CMakeLists.txt
===================================================================
--- trunk/examples/python/CMakeLists.txt 2009-07-02 16:57:25 UTC (rev 10109)
+++ trunk/examples/python/CMakeLists.txt 2009-07-02 17:05:19 UTC (rev 10110)
@@ -103,7 +103,7 @@
set(
python_SCRIPTS
${python_SCRIPTS}
- pyqt4_test.py
+ pyqt4_example.py
)
endif(ENABLE_pyqt4)
Copied: trunk/examples/python/pyqt4_example.py (from rev 10108, trunk/examples/python/pyqt4_test.py)
===================================================================
--- trunk/examples/python/pyqt4_example.py (rev 0)
+++ trunk/examples/python/pyqt4_example.py 2009-07-02 17:05:19 UTC (rev 10110)
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+#
+# A simple PLplot/PyQt example
+#
+# Copyright (C) 2009 Hazen Babcock
+#
+# This file is part of PLplot.
+#
+# PLplot is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Library Public License as published
+# by the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# PLplot is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public License
+# along with PLplot; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+
+import sys
+from PyQt4 import QtCore, QtGui
+import plplot
+import plplot_pyqt4
+
+class QPlot(QtGui.QMainWindow):
+ def __init__(self):
+ QtGui.QMainWindow.__init__(self, None)
+
+ self.plot = plplot_pyqt4.QtExtWidget(800, 800, self)
+ self.setCentralWidget(self.plot)
+
+ plplot_pyqt4.plsetqtdev(self.plot)
+ plplot.plsdev("extqt")
+ plplot.plinit()
+
+ self.resize(400,400)
+
+ def cleanup(self):
+ plplot.plend()
+ plplot_pyqt4.plfreeqtdev()
+
+ def paintEvent(self, event):
+ plplot.pladv(0)
+ plplot.plenv(0, 10, 0, 10, 0, 0)
+ plplot.pllab("X", "Y", "X vs Y")
+ self.plot.show()
+
+
+app = QtGui.QApplication(sys.argv)
+plot = QPlot()
+plot.show()
+app.exec_()
+plot.cleanup()
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|