|
@@ -7,6 +7,9 @@ from tkinter.ttk import Combobox
|
|
|
from matplotlib.figure import Figure
|
|
|
from matplotlib.backends.backend_tkagg import (FigureCanvasTkAgg, NavigationToolbar2Tk)
|
|
|
from random import choice
|
|
|
+import matplotlib.pyplot as plt
|
|
|
+import matplotlib
|
|
|
+import numpy as np
|
|
|
|
|
|
|
|
|
|
|
@@ -117,31 +120,35 @@ class Interface():
|
|
|
self.but_fw3.grid(column=0, row=3)
|
|
|
|
|
|
def create_Figure(self):
|
|
|
- self.fig = Figure(figsize=(10, 4), dpi=70)
|
|
|
+ self.f_graf = ttk.LabelFrame(Interface.window,
|
|
|
+ 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.ax = self.fig.add_subplot(111)
|
|
|
- x_list = [0]
|
|
|
- y_list = [0]
|
|
|
- counter = 10000
|
|
|
- while counter > 0:
|
|
|
- x_direction = choice([1, -1])
|
|
|
- x_dist = choice([1, 2, 3, 4])
|
|
|
- x_step = x_direction * x_dist
|
|
|
- x = x_list[-1] + x_step
|
|
|
- x_list.append(x)
|
|
|
-
|
|
|
- y_direction = choice([1, -1])
|
|
|
- y_dist = choice([1, 2, 3, 4])
|
|
|
- y_step = y_direction * y_dist
|
|
|
- y = y_list[-1] + y_step
|
|
|
- y_list.append(y)
|
|
|
-
|
|
|
- counter -= 1
|
|
|
- self.ax.scatter(x_list, y_list, s=1)
|
|
|
-
|
|
|
- self.canvas1 = FigureCanvasTkAgg(self.fig, master=Interface.window)
|
|
|
- self.canvas1.draw()
|
|
|
- self.canvas1.get_tk_widget().grid(column=1, row=1, columnspan=2, rowspan=2)
|
|
|
+ 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.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.grid(column=0, row=0)
|
|
|
+ self.grafspin = Spinbox(self.f_grafbtn, from_=0, to=100, width=7)
|
|
|
+ self.grafspin.grid(column=0, row=1)
|
|
|
+ self.t1grafbtn = Label(self.f_grafbtn, text="Времени конца времени", fg="black")
|
|
|
+ self.t1grafbtn.grid(column=0, row=2)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
def start(self):
|
|
|
self.mennuB()
|
|
@@ -199,4 +206,4 @@ class Interface():
|
|
|
menubar1.add_cascade(label='Help', menu=setting_menu6)
|
|
|
|
|
|
interface = Interface()
|
|
|
-interface.start()
|
|
|
+interface.start()
|