李俊誼期末考60分

關鍵程式碼

def draw():#按下按鈕Button1
    for firm in firms:
        t=(firm, year.get())
        x = 10+20*stdev[t]*2*3**0.5 #放大20
        y = 500 - 10*mean[t]*12     #放大10
        dot=canvas.create_oval(x-5,y-5,x+5,y+5,fill='blue')
        lab=canvas.create_text(x+10,y,text=firm[4:7],anchor=W,font=('微軟中黑體', 16))
def delete():#按下按鈕Button2執行Delete
    canvas.delete('all')
years=[x for x in range(2007, 2025)]
year=IntVar(tk)
year.set(years[-1])
label = Label(tk, text="年度",font=('Arial',30,'bold'),).pack(side=LEFT)  #距離左側
option1 = OptionMenu(tk, year, *years).pack(side=LEFT)
button1 = Button(tk, text="李俊誼繪圖 ",font=('Arial',20,'bold'), command = draw, bg='black',fg='white').pack(side=LEFT)
button2 = Button(tk, text="李俊誼刪除 ",font=('Arial',20,'bold'), command = delete, bg='black',fg='white').pack(side=LEFT)
tk.mainloop()
#label button1 button2都改變字體

留言

  1. 風險管理https://leo1050317.blogspot.com/2025/06/blog-post.html
    https://leo1050317.blogspot.com/2025/06/60.html

    回覆刪除

張貼留言

這個網誌中的熱門文章

李俊誼風險管理期末考

李俊誼Python讀取CSV檔案SPDR標普500ETF在1993/1/29至2525/3/20