代码拉取完成,页面将自动刷新
同步操作将从 Lingjie Fan/复旦2023光学荣誉课-示例 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import tkinter
import numpy as np
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure
window = tkinter.Tk()
window.title("复旦2023光学荣誉课示例")
f = Figure(figsize=(5,4), dpi=100)
a = f.add_subplot(111)
x = np.arange(0,3,0.01)
y = np.sin(1*2*np.pi*x)+np.sin(1*2*np.pi*x)
a.plot(x,y)
canvas = FigureCanvasTkAgg(f, master=window)
canvas.draw()
canvas.get_tk_widget().pack(side=tkinter.TOP, fill=tkinter.BOTH, expand=tkinter.YES)
omega1_value = 1*2*np.pi
omgea2_value = 1*2*np.pi
def wave_show(value):
y = np.sin(float(omega1.get())*x)+np.sin(float(omega2.get())*x)
a.clear()
a.plot(x,y)
canvas.draw()
omega1 = tkinter.Scale(window, from_=1*2*np.pi, to = 10*2*np.pi, resolution=0.5*np.pi, length=200, sliderlength=20, label="omega1", orient=tkinter.HORIZONTAL, command=wave_show)
omega2 = tkinter.Scale(window, from_=1*2*np.pi, to = 10*2*np.pi, resolution=0.5*np.pi, length=200, sliderlength=20, label="omega2", orient=tkinter.HORIZONTAL, command=wave_show)
omega1.pack()
omega2.pack()
omega1.set(value=1)
omega2.set(value=1)
window.mainloop()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。