n jako parametr

This commit is contained in:
DawidSchneider 2024-10-26 23:41:41 +02:00
parent 5166a32ad3
commit d4b3304105

10
main.py
View File

@ -1,8 +1,9 @@
import matplotlib.pyplot as plt
import numpy as np
import sys
class Plot:
def __init__(self):
def __init__(self, n):
self.fig, self.ax = plt.subplots()
self.cid_click = self.fig.canvas.mpl_connect('button_press_event', self.onclick)
@ -17,7 +18,7 @@ class Plot:
self.curvePoints = []
self.isDrawing = False
self.inputMode = 0
self.n = 15
self.n = n
def onclick(self, event):
if self.inputMode == 0:
@ -63,7 +64,10 @@ class Plot:
def run(self):
plt.show()
n = 10
if len(sys.argv) > 1:
n = int(sys.argv[1])
if __name__ == "__main__":
plot = Plot()
plot = Plot(n)
plot.run()