• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Bindings for graphics lib QCustomPlot2 for PyQt5


Commit MetaInfo

修訂a8a64f904e0cada9d3b36d531cdebabd91205dcd (tree)
時間2020-11-12 15:38:39
作者Sergey Salnikov <salsergey@gmai...>
CommiterSergey Salnikov

Log Message

Update README.md

Updated example to make it really executable.

Change Summary

差異

--- a/README.md
+++ b/README.md
@@ -41,10 +41,20 @@ $ pip install QCustomPlot2
4141 Now let's take a look at some code:
4242
4343 ```python
44+import sys
45+import math
46+from PyQt5.QtCore import Qt
4447 from PyQt5.QtGui import QPen, QBrush, QColor
48+from PyQt5.QtWidgets import QApplication, QMainWindow
4549 from QCustomPlot2 import *
4650
51+
52+app = QApplication(sys.argv)
53+window = QMainWindow()
54+window.resize(800, 600)
55+
4756 customPlot = QCustomPlot()
57+window.setCentralWidget(customPlot)
4858
4959 graph0 = customPlot.addGraph()
5060 graph0.setPen(QPen(Qt.blue))
@@ -63,7 +73,12 @@ graph0.setData(x, y0)
6373 graph1.setData(x, y1)
6474
6575 customPlot.rescaleAxes()
66-customPlot.setInteractions(QCPInteractions(QCP.iRangeDrag | QCP.iRangeZoom | QCP.iSelectPlottable))
76+customPlot.setInteraction(QCP.iRangeDrag)
77+customPlot.setInteraction(QCP.iRangeZoom)
78+customPlot.setInteraction(QCP.iSelectPlottables)
79+
80+window.show()
81+sys.exit(app.exec_())
6782 ```
6883
6984 That's all!