プログラミング初心者です"(-""-)"
使用しているソフト:pycharm
ボタンが表示され、ボタンをクリックするたび1,2,3,4,5・・・・
と実行結果に表示されるものを作りたいのですがうまくいかないです。
import tkinter as tk root = tk.Tk() class App: count = 0 def btn_action(self): self.count += 1 return self.count app = App() btn = tk.Button(root,text="count") btn.bind("<Button-1>",app.btn_action()) btn.pack() root.mainloop()
ボタンを押した後のエラー
Exception in Tkinter callback Traceback (most recent call last): File "C:\Program Files\Python36\lib\tkinter\__init__.py", line 1699, in __call__ return self.func(*args) TypeError: 'int' object is not callable
どこが原因なのかわからないです。。。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/10/06 03:05
退会済みユーザー
2017/10/06 04:09
2017/10/06 06:45