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.
Asked
Active
Viewed 435 times
0
-
1What have you done / tried so far ? If you could provide a short example reproducing your problem, you might get more usefule answers. Also, this question (and answer) might have relevant information to your problem: http://stackoverflow.com/questions/16938647 – FabienAndre Jun 08 '13 at 11:30
1 Answers
2
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

A. Rodas
- 20,171
- 8
- 62
- 72
-
thanks for ur response and i am using text widget. i will try with this and let u know later. – vaasu Jun 08 '13 at 11:57
-
@ RODAS http://stackoverflow.com/questions/16938647/python-code-for-serial-data-to-print-on-window, i just found this now, which was answered by u.here what i want is exatly steve want here. can u plz resend the code by includung text.delete(1.0, 'end') # print new serial data in the main code. please. – vaasu Jun 08 '13 at 12:34
-
1@vaasu The user who posted that question also commented my answer, asking how could be possible to do _exactly_ what you are asking here. Please remove this duplicate question and refer to the original answer. – A. Rodas Jun 08 '13 at 12:40
-
@ RODAS I am sorry.i refered the original one, but i need to clear the screen before printing the next received data. i could not do that, because i am new to python and started learning from couple of days. if possible help me. – vaasu Jun 08 '13 at 12:47
-
@vaasu: If you read all the comments below his answer to that other question, you'll notice that he modified his code to remove the existing output (i.e. clear the screen) before displaying the new output. It's there in the code, and is exactly what he typed above. Your question has been answered multiple times. However, as the answer to the other question is more complete, I'll echo his request to delete this duplicate question and refer to the other one. – Justin S Barrett Jun 09 '13 at 00:49
-
It is working, but the entire text is not displaying on the window. when i receive long text(5 lines), it is only displaying few characters from last line of the text.No problem for displaying single line of text, but had problem with multiple lines to display. – vaasu Jun 13 '13 at 12:41