|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
def get_comment_message(self):
for i in range(0,len(self.comment_message)):
self.aa = self.comment_message[i]
i += 1
yield self.aa
else:
yield ["别按了","已经到了底了"]
我遍历了self.comment_message,如果后面没有了,就打印这句"别按了","已经到了底了",,但是如果接着按的话,就会抛出这个异常:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\tkinter\__init__.py", line 1705, in __call__
return self.func(*args)
File "C:\Users\Administrator\PycharmProjects\Baohui_Attendance\views.py", line 42, in next_message
b = next(self.menber_comment_message)
StopIteration
所以我得怎么处理比较好,就是遍历完了之后,如果接着按bottom,它直接打印这句["别按了","已经到了底了"],,继续按就继续执行这句["别按了","已经到了底了"] |
|