0
私はTkinterの(Pyhton)で開始/一時停止ボタンをプログラムしようとしていますが、次のコードは動作しません。更新画像
def startpause():
if startpause_button.cget('image')=='start_image':
startpause_button.config(image=pause_image)
else:
startpause_button.config(image=start_image)
return
start_image=ImageTk.PhotoImage(file='start.png')
pause_image=ImageTk.PhotoImage(file='pause.png')
startpause_button=ttk.Button(frame,image=start_image,command = startpause)
私は理解しては問題は程度でありますcget(return( 'pyimage3'))と返すものは何かをチェックする値として入れるべきか分からない( "( 'pyimage3')"は機能しません)。
この問題についてご意見はありますか?
ありがとうございます。
文字列「start_image」ではなく、「start_image」と比較してみてください。 –