python - AttributeError: Tkinter Button instance has no __call__ method -


here code in question:

from tkinter import * import time  class application(frame):     """jungle timers"""      def __init__(self, master):         """initialize frame."""         frame.__init__(self, master)         self.grid()         self.create_widgets()      def create_widgets(self):         """buttons timer."""         #create buttons         self.b1 = button(self, text = "own blue in: 0", command = self.b1)         self.b1.grid()          self.r1 = button(self, text = "own red in: 0", command = self.r1)         self.r1.grid()          self.b2 = button(self, text = "their blue in: 0", command = self.b2)         self.b2.grid()          self.r2 = button(self, text = "their red in: 0", command = self.r2)         self.r2.grid()          self.d = button(self, text = "dragon in: 0", command = self.d)         self.d.grid()          self.baron = button(self, text = "baron in: 0", command = self.baron)         self.baron.grid()      def b1(self):         x = 300         while x > 0:             self.b1(text = "own blue in: " + str(x))             x -= 1             time.sleep(1)      def r1(self):         x = 300         while x > 0:             self.r1(text = "own red in: " + str(x))             x -= 1             time.sleep(1)         def b2(self):         x = 300         while x > 0:             self.b2(text = "their blue in: " + str(x))             x -= 1             time.sleep(1)      def r2(self):         x = 300         while x > 0:             self.r2(text = "their red in: " + str(x))             x -= 1             time.sleep(1)      def d(self):         x = 360         while x > 0:             self.d(text = "dragon in: " + str(x))             x -= 1             time.sleep(1)      def baron(self):         x = 420         while x > 0:             self.baron(text = "baron in: " + str(x))             x -= 1             time.sleep(1)     root = tk() root.title("jungle timers") root.geometry("200x210")  app = application(root)  root.mainloop() 

with code i'm getting attributeerror: button instance has no call method on line 37.

self.b1(text = "own blue in: " + str(x)) 

am doing wrong or there easy way fix this? appreciated.

it should be:

self.b1.config(text = "own blue in: " + str(x)) 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

django - CSRF verification failed. Request aborted. CSRF cookie not set -