iT邦幫忙

1

(已解決)如何讓python tkinter依照讀到資料庫的數字 進行圖片切換(動畫) 第1張圖跑到10張

各位資深前輩好 小弟目前有一個問題
我之前是讀取(get)同事架設的網頁文字字串來讓我的圖片切換(動畫)
假設網頁字串60 我只要按Button就會啟動funtion 第0張圖跑到60張
有一個動畫的效果 但是現在要使用數據庫新增修改數字字串
目前需求是我自己架設了數據庫我從裡面新增一個數值假設為10
https://ithelp.ithome.com.tw/upload/images/20200504/201265771K1fCbBfc9.png

那他就要有我上述說的效果 從0跑到10張照片 動畫效果
可以想像 油門慢慢從0吹到100 儀錶板(電子)的一格一格的上升
請問各位資深前輩我下列的程式該怎麼改?
附上程式....
https://ithelp.ithome.com.tw/upload/images/20200504/20126577tW5OAPkb3z.png 共61張圖

def changeimage():
    
    global count , label2 , textavariable , button 

    # print(count)
    # print(nodata)

    if int(nodata) > count:
        label2['image'] = animationss[count]  
        count+=1
        #count + 1
        if count >= 60:
           count + 1
           label2['image'] = animationss[count]
        window.after(100, changeimage)
    else:
        window.after(500, changeimage)
    
def uplabels():

    global nodata , count , textavariable , button ,datas
    
    datas = requests.get("http://192.168.174.1/RasperryDB3.PHP")
    variable.set((str(datas.text)))
    int(datas.text)
    nodata = datas.text
    count = 0
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友回答

立即登入回答