0
イメージボタンを作っています。私のコードは以下の通りです。python tkinter画像ボタンの使い方は?
button1=Button(root,width=80,height=200)
image1=PhotoImage(file="/home/imagefolder/1.png")
button1.config(image=self.image1)
button1.image=image1
button.pack(side=left)
私はファイル "1.png"を持っていないとき、私は空としてボタンを設定したいと思います。しかし、今私はエラーがあります:
tkinter.TclError: couldn't open "/...". no such file or directory.
どうすれば解決できますか?
は、それがうまく働きました。ありがとうございました :) – Kmin