python - TypeError: argument of type 'method' is not iterable -
error
traceback (most recent call last): file "c:/users/rcs/desktop/project/shm.py", line 435, in <module> app = shm() file "c:/users/rcs/desktop/project/shm.py", line 34, in __init__ frame = f(container, self) file "c:/users/rcs/desktop/project/shm.py", line 384, in __init__ if "3202" in q: typeerror: argument of type 'method' not iterable
code
some part of code, initialisation , all
while 1: q = variable1.get if "3202" in q: variable2.set("ni node3202") try: switch(labelframe2, labelframe1) except: switch(labelframe3, labelframe1) elif "3212" in q: variable2.set("ni node3212") try: switch(labelframe1, labelframe2) except: switch(labelframe3, labelframe2) elif "3214" in q: variable2.set("ni node3214") try: switch(labelframe1, labelframe3) except: switch(labelframe2, labelframe3) else: none
some other part of code
def switch(x, y): if x.isgridded: x.isgridded = false x.grid_forget() y.isgridded = true y.grid(row=0, column=0) else: return false
i trying create switch between 3 labelframe
s inside labelframe
, , outside labelframe
other labelframe
s not changing.
i have read similar answers don't want use __iter__()
in code. can provide other suggestions?
you forgot call entry.get()
method:
q = variable1.get() # ^^ call method
because method object doesn't support containment testing directly, python instead trying iterate on object see if there elements contained in match string.
if call method, string value instead. strings support containment testing.
Comments
Post a Comment