print the data on window screen and then clear the window screen before printing other data.in python

跟風遠走 提交于 2019-12-13 08:42:15

问题


I can receive serial data and can print on the window screen(Tkinter top).when i receive serial data again, this newly received serial data should start printing on the window screen by wiping out the previous serial data.This process has to happen for every received serial data. I had a code to receive and print data on window, but it prints all the received data on the screen with out wiping the old data.


回答1:


In that case, all you have to do is remove the previous content of the widget just before printing the new one. If you have an Entry widget, use the delete method:

entry.delete(0, 'end')
# print new serial data

Or if you have a Text widget:

text.delete(1.0, 'end')
# print new serial data


来源:https://stackoverflow.com/questions/16999041/print-the-data-on-window-screen-and-then-clear-the-window-screen-before-printing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!