python - Tkinter bind function -


i have python code print text written prompt:

from tkinter import *  class commandlist(object):     show = false     def __init__(self):         self.show = false      def show(self):         print "showed"      def hide(self):         self.show = false       def is_showed(self):         return self.show   master = tk() tab = commandlist()    e = entry(master, width=1000) e.pack()  def enter(event):     master.quit() def escape(event):     exit() def tabulator(tab):     print type(tab)     tab.show()   e.bind('<control_l>j', enter) e.bind('<return>', enter) e.bind('<escape>', escape)  e.bind('<tab>', lambda event, tab=tab: tabulator(tab))  e.focus_set() master.mainloop() print e.get() 


it works fine, when press tab key, error:

<class '__main__.commandlist'> exception in tkinter callback traceback (most recent call last):   file "/usr/lib/python2.7/lib-tk/tkinter.py", line 1535, in __call__     return self.func(*args)   file "stack-question.py", line 41, in <lambda>     e.bind('<tab>', lambda event, tab=tab: tabulator(tab))   file "stack-question.py", line 34, in tabulator     tab.show() typeerror: 'bool' object not callable 

i see tab type commandlist why "typeerror: 'bool' object not callable" ??

you defined show bool equal false first line in commandlist class, didn't use anyways. when have commandlist object, show() attempts call class-level bool defined, , not method.


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -