n jako parametr
This commit is contained in:
parent
5166a32ad3
commit
d4b3304105
10
main.py
10
main.py
@ -1,8 +1,9 @@
|
|||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
import sys
|
||||||
|
|
||||||
class Plot:
|
class Plot:
|
||||||
def __init__(self):
|
def __init__(self, n):
|
||||||
self.fig, self.ax = plt.subplots()
|
self.fig, self.ax = plt.subplots()
|
||||||
|
|
||||||
self.cid_click = self.fig.canvas.mpl_connect('button_press_event', self.onclick)
|
self.cid_click = self.fig.canvas.mpl_connect('button_press_event', self.onclick)
|
||||||
@ -17,7 +18,7 @@ class Plot:
|
|||||||
self.curvePoints = []
|
self.curvePoints = []
|
||||||
self.isDrawing = False
|
self.isDrawing = False
|
||||||
self.inputMode = 0
|
self.inputMode = 0
|
||||||
self.n = 15
|
self.n = n
|
||||||
|
|
||||||
def onclick(self, event):
|
def onclick(self, event):
|
||||||
if self.inputMode == 0:
|
if self.inputMode == 0:
|
||||||
@ -63,7 +64,10 @@ class Plot:
|
|||||||
def run(self):
|
def run(self):
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
|
n = 10
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
n = int(sys.argv[1])
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
plot = Plot()
|
plot = Plot(n)
|
||||||
plot.run()
|
plot.run()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user