ВОТ КОТЯРА:
from tkinter import *
import math
root = Tk()
root.title("Построение графика функции y = sin(x)")
root.geometry("1330x650")
canvas = Canvas(root, width=1040, height=640, bg='#0000ff')
canvas.pack(side='right')
#LINII SETKI PO VERTICAL
for y in range(51):
k = 20 * y
canvas.create_line(20+k, 640, 20+k, 0, width=1, fill='#ff0000')
#LINII SETKI PO HORIZANTAL
for x in range(31):
k = 20 * x
canvas.create_line(0, 20+k, 1040, 20+k, width=1, fill='#ff0000')
#LINII COORDINAT Х I У
canvas.create_line(20, 20, 20, 620, width=2, arrow=FIRST, fill='#00ffff')# OS' Y
canvas.create_line(10, 320, 1020, 320, width=2, arrow=LAST, fill='#00ffff') # OS' X
canvas.create_text(20, 10, text='300', fill='#00ffff')
canvas.create_text(20, 630, text='-300', fill='#00ffff')
canvas.create_text(10, 310, text='0', fill='#00ffff')
canvas.create_text(1030, 310, text='1000', fill='#00ffff')
label_w = Label(root, text='Cyclicheskaya chyastota')
label_w.place(x = 0, y = 10)
label_phi = Label(root, text='Smesheniye graphika po X:')
label_phi.place(x = 0, y = 30)
label_A = Label(root, text='Amplituda:')
label_A.place(x = 0, y = 50)
label_dy = Label(root, text='Smeshenie graphika po Y:')
label_dy.place(x = 0, y = 70)
entry_w = Entry(root)
entry_w.place(x=150, y=10)
entry_phi = Entry(root)
entry_phi.place(x=150, y=30)
entry_A = Entry(root)
entry_A.place(x=150, y=50)
entry_dy = Entry(root)
entry_dy.place(x=150, y=70)
def sinus(w, phi, A, dy):
global sin
sin = 0
xy = []
for x in range(1000):
y = math.sin(x * w)
xy.append(x + phi)
xy.append(y * A + dy)
sin = canvas.create_line(xy, fill='yellow')
def clean():
canvas.delete(sin)
btn_calc = Button(root, text='Rasschitate')
btn_calc.bind('<Button-1>', lambda event: sinus(float(entry_w.get()),
float(entry_phi.get()),
float(entry_A.get()),
float(entry_dy.get())))
btn_calc.place(x=10, y=100)
btn_clean = Button(root, text='Ochistite')
btn_clean.bind('<Button-1>', lambda event: clean())
btn_clean.place(x=100, y=100)
root.mainloop()