|
@@ -124,31 +124,47 @@ class Interface():
|
|
|
text='Количество импульсов в минуту', relief=SOLID)
|
|
|
self.f_graf.grid(column=1, row=1, columnspan=2, rowspan=2)
|
|
|
self.fig = Figure(figsize=(7, 4), dpi=80)
|
|
|
- self.t = np.linspace(0, 2 * np.pi, num=100)
|
|
|
+ self.t = np.linspace(0, 100, num=10000)
|
|
|
self.ax = self.fig.add_subplot(111)
|
|
|
self.ax.set_xlabel('Время, с')
|
|
|
self.ax.set_ylabel('Импульсы')
|
|
|
- self.ax.plot(self.t, np.sin(self.t), '-rh', linewidth=3, markersize=1, markerfacecolor='b',
|
|
|
- label=r'$\ y=sin(x) $')
|
|
|
-
|
|
|
+ self.ax.plot(self.t, 5000 + 5000 * np.sin(self.t / 10), '-rh',
|
|
|
+ linewidth=1, markersize=1, markerfacecolor='b')
|
|
|
self.ax.grid(color='black', linewidth=1.0)
|
|
|
- self.ax.legend(fontsize=12)
|
|
|
-
|
|
|
self.canvas = FigureCanvasTkAgg(self.fig, master=self.f_graf)
|
|
|
self.canvas.draw()
|
|
|
self.canvas.get_tk_widget().grid(column=0, row=0)
|
|
|
Interface.window.after(100, None)
|
|
|
self.f_grafbtn = ttk.LabelFrame(self.f_graf, text='Время отоброжения', padding=[8, 10])
|
|
|
self.f_grafbtn.grid(column=1, row=0)
|
|
|
- self.tgrafsp = Label(self.f_grafbtn, text="Начало время, с", fg="black")
|
|
|
+ self.tgrafsp = Label(self.f_grafbtn, text="Начало времени, с", fg="black")
|
|
|
self.tgrafsp.grid(column=0, row=0)
|
|
|
- self.grafspin = Spinbox(self.f_grafbtn, from_=0, to=100, width=7)
|
|
|
+ self.grafspin = Spinbox(self.f_grafbtn, from_=0, to=1000, increment=100, width=7)
|
|
|
self.grafspin.grid(column=0, row=1)
|
|
|
- self.t1grafbtn = Label(self.f_grafbtn, text="Времени конца времени", fg="black")
|
|
|
+ self.t1grafbtn = Label(self.f_grafbtn, text="Выбор конца времени", fg="black")
|
|
|
self.t1grafbtn.grid(column=0, row=2)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ self.button_time1 = Button(self.f_grafbtn, text="start",
|
|
|
+ bg="lightgray", fg="black", command=self.clicked_time)
|
|
|
+ self.button_time1.grid(column=0, row=3, sticky=EW)
|
|
|
+ self.tgrafsp1 = Label(self.f_grafbtn, text="Конец времени, с", fg="black")
|
|
|
+ self.tgrafsp1.grid(column=0, row=4)
|
|
|
+ self.Time_flag = 'disabled'
|
|
|
+ self.spinbox_varTime = StringVar(value=100)
|
|
|
+ self.grafspin1 = Spinbox(self.f_grafbtn, from_=100, to=50000, increment=100, width=7,
|
|
|
+ textvariable=self.spinbox_varTime, state=[self.Time_flag])
|
|
|
+ self.grafspin1.grid(column=0, row=5)
|
|
|
+ self.spinbox_var1 = StringVar(value=0)
|
|
|
+ self.tgrafspTmin = Label(self.f_grafbtn, text="Нижняя граница, имп/с", fg="black")
|
|
|
+ self.tgrafspTmin.grid(column=0, row=6)
|
|
|
+ self.grafspinTmin = Spinbox(self.f_grafbtn, from_=0, to=5000,
|
|
|
+ textvariable=self.spinbox_var1, increment=500, width=7)
|
|
|
+ self.grafspinTmin.grid(column=0, row=7)
|
|
|
+ self.tgrafspTmax = Label(self.f_grafbtn, text="Верхняя граница, имп/с", fg="black")
|
|
|
+ self.tgrafspTmax.grid(column=0, row=8)
|
|
|
+ self.spinbox_var2 = StringVar(value=10000)
|
|
|
+ self.grafspinTmax = Spinbox(self.f_grafbtn, from_=5000, to=10000, increment=500,
|
|
|
+ textvariable=self.spinbox_var2, width=7)
|
|
|
+ self.grafspinTmax.grid(column=0, row=9)
|
|
|
|
|
|
def start(self):
|
|
|
self.mennuB()
|
|
@@ -182,6 +198,28 @@ class Interface():
|
|
|
self.but_fw3.configure(text='<---')
|
|
|
self.txt1_fw3.configure(text=' 0 B ')
|
|
|
|
|
|
+ def clicked_time(self):
|
|
|
+ if self.Time_flag == 'disabled':
|
|
|
+ self.Time_flag = 'normal'
|
|
|
+ self.grafspin1.configure(state=[self.Time_flag])
|
|
|
+ else:
|
|
|
+ self.Time_flag = 'disabled'
|
|
|
+ self.grafspin1.configure(state=[self.Time_flag])
|
|
|
+ self.fig.clear()
|
|
|
+ self.fig = Figure(figsize=(7, 4), dpi=80)
|
|
|
+ self.ax = self.fig.add_subplot(111)
|
|
|
+ self.t = np.linspace(0, int(self.spinbox_varTime.get()), num=10000)
|
|
|
+ self.ax.set_ylim(bottom=0, top=10000)
|
|
|
+ self.ax.plot(self.t,
|
|
|
+ int(self.spinbox_var1.get()) + abs(int(self.spinbox_var1.get()) - int(self.spinbox_var2.get())) * 0.5 * (1 + np.sin(self.t / 10)),
|
|
|
+ '-rh', linewidth=1, markersize=1, markerfacecolor='b')
|
|
|
+ self.ax.grid(color='black', linewidth=1.0)
|
|
|
+ self.canvas = FigureCanvasTkAgg(self.fig, master=self.f_graf)
|
|
|
+ self.canvas.draw()
|
|
|
+ self.canvas.get_tk_widget().grid(column=0, row=0)
|
|
|
+ Interface.window.after(100, None)
|
|
|
+
|
|
|
+
|
|
|
|
|
|
def mennuB(self):
|
|
|
menubar1 = tk.Menu(self.window)
|