import math #第9列(z1=10), 13列(廣域變數),插入16列cos,插入18繪圖 tk = Tk() #建構視窗名為tk tk.geometry('1200x400') #1200像素 tk.title("python tkinter三角函數") canvas = Canvas(tk, width=1200, height=400, bg='gray') canvas.grid(row=0,column=0,padx=5,pady=5,columnspan=3) delay=10 # milliseconds, 1/1000秒 x1,y1,z1=0,200,10 #Python特徵: 多變數=多個值 h=190 #上下範圍 相當於數字1到-1 degree=0 #角度degree def LauHou(): global x1, y1, z1 x2 = x1 + 1 y2=200 - h*math.sin(0.05*x2)#座標從左上角0.... z2=200 - h*math.cos(0.05*x2) l1=canvas.create_line(x1,y1,x2,y2,fill='red',width=5) l2=canvas.create_line(x1,z1,x2,z2,fill='pink',width=5) if (x2
這個網誌中的熱門文章
學習Bro code製作計算機 display.value = eval(display.value) disply的vlue用eval(display.value)取代,算是「字串」運算結果 eval()內建函數(方法) in-line線內設定樣式。readonly唯讀read only。電腦的.的接續術性或函數disply.value面板顯示的內容value值 + 7 8 9 - 4 5 6 * 1 2 3 / 0 . 算 刪 你 好 阿 https://www.youtube.com/watch?v=I5kj-YsmWjM Build this JS calculator in 15 minutes!
留言
張貼留言