📜  tkinter sin - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:49.759000             🧑  作者: Mango

代码示例1
from tkinter import *
import math

master = Tk()

w = Canvas(master, width=200, height=100)
w.pack()


x = 0
width = 200

for x in range(0, width):
    y = int(50 + 50*math.sin(4*((float(x)/width)*(2*math.pi) )))
    w.create_rectangle(1, 1, 1, 10, fill="yellow")
mainloop()