问题描述:
使用tkinter的Text对象建立一个self.text_screen对象
可以通过如下代码的前半部分刷新为“是否打印清单”,但后面函数却始终无法二次刷新。(确实执行了注册的函数)详细如下:(pycharm)
def print_deal_list_state(self):
self.text_screen['state']=NORMAL
self.text_screen.delete('1.0',END)
self.text_screen.insert('1.0',('\n\n\t是否打印交易清单?'))
self.text_screen['state']=DISABLED
self.btn_deposit['state']=DISABLED
self.btn_transfer['state']=DISABLED
self.btn_withdraw['state']=DISABLED
def ending_thanking():
self.text_screen['state']=NORMAL
self.text_screen.delete('1.0',END)
self.text_screen.insert('1.0','\n\n\t谢谢惠顾!')
self.main_state()
def press_ok():
self.text_screen['state']=NORMAL
self.text_screen.delete('1.0',END)
self.text_screen.insert('1.0','\n\n\t请稍等,打印中...')
self.text_screen.delete('1.0',END)
self.text_screen.insert('1.0','\n\n\t打印完毕')
ending_thanking()
def press_cancel():
ending_thanking()
self.btn_ok.configure(command=lambda *args:self.press_ok())
self.btn_cancel.configure(command=lambda *args:self.press_cancel())
解决方法:
同一个调用里,两次对Text插件进行插入删除,中间没有更新
self.text_screen.update()