July 16th, 2013, 05:11 AM
Display data on tkinter window
I don't want to update the Tkinter screen for every 100ms.
one pc is communicating with other pc.
when one pc sends data, the other pc receives data and display's on tk window. I want this received data on the tk window until it receives one more data from transmitting pc.
when one more data received, the tk window should update with this data and display it until it receives other data from transmitter.
This process has to be done every time transmitter sends data.
The time period between the transmitted data is uneven.
It may transmit data in 1 min, or on 4 min or may be in 10 min.
Irrespective of time period between the transmitted data, the receiver pc has to receive and display on the tk window.
July 17th, 2013, 07:50 AM
Could you be a bit more specific?
data = 0
if data != incoming_data:
data = incoming_data
Sumthing like that doesn't work?
July 17th, 2013, 08:37 AM
Originally Posted by J Dihzy
Two pc's are connected with RS 232 label for serial communication. one pc for transmitting and other pc for receiving.
I will run this code in receiving pc.
This code is to receive text from a transmitting pc and display it on tkinter window of the receiving pc.
The received text has to be displayed on tk window Until it receives other text from transmiting pc.
But With my code the contents of the received text is displaying on tk window for only few milliseconds, then after tk window looks plain with no contents of data. When it receives another text from transmitter, it again displays the text only for milliseconds and the text vanishes.
The text is not a pre defined bunch of messages of equal lengh, the length of the text vary all the time.
The time period between the text's is not constant, it also vary all the time.
The transmitter sends text at differnet time periods,first text in 5 min, next text may be in 10 min and the third text may be in 30 min and so on. I don't want to clear the contents of the text from the tk window until it receives other text from transmitter.
The font size i choose is 37 and I dont need a scrool bar to scrool the window, because transmitter sends maximum of 5 lines to display on receiver tk widow.
THE DATA WHICH IS DISPLAYING ON TKINTER WINDOW SHOULD KEEP ON DISPLAYING UNTIL IT RECEIVES DATA AGAIN FROM TRANSMITTER.
import Tkinter as tk
def __init__(self, queue):
self.queue = queue
s = serial.Serial('COM10',9600)
text = s.readline(s.inWaiting())
frameLabel = tk.Frame(self, padx=40, pady =40)
self.text = tk.Text(frameLabel, wrap='word', font='TimesNewRoman 37',
self.queue = Queue.Queue()
thread = SerialThread(self.queue)
app = App()