本文共 624 字,大约阅读时间需要 2 分钟。
所遇问题:
当想要使用Text中的绑定事件回车清空Text中的内容时,总是先执行清空操作,再执行回车操作,这样每次Text其它内容都清空了,但还是会留下一个回车。
思路:
示例:
def func_thrd_ExecuteCommand(): time.sleep(0.01) self.txt_.delete(0.0, END) def handle_Input(event): if event.keycode==13: thrd_once=threading.Thread(target=func_thrd_ExecuteCommand) thrd_once.start() txt_ = Text(root) txt_.bind('',func=handle_Input) txt_.pack(side=BOTTOM, padx=0, fill='both', expand=NO)
转载地址:http://aszfd.baihongyu.com/