On Thu, 18 Jul 2013 16:39:37 +0530
Srinivas Rao <[email protected]> wrote:
> i even tried this way, here the received data displaying on tk until it
> receives other data from transmitter. but the main problem is:
> when it receives a data of 3 or 4 lines, it only displaying the last
> few charecters of the data. there is no problem for displaying single
> line of data. but when the receiving data increases by size, the
> complete received data is not displaying ans as i said before it only
> displaying last few characters of the data on the tk window.
If you tried my example from the last post:
> >
> > def process_serial(self):
> > while self.queue.qsize():
> > try:
> > new = self.queue.get()
> > self.text.delete(1.0, 'end')
> > self.text.insert('end', new)
> > except Queue.Empty:
> > pass
> > self.after(1500, self.process_serial)
> >
> > which will empty the text only if new content is available (ok, this
> > does not handle the case of multiple new items in the queue, but I
> > guess you'll see the point...).
then, as I said, it will of course only show the last element in the
queue; to handle multiple queue items you might for example add a
variable to process_serial() as in:
def process_serial(self):
firstitem = True
while self.queue.qsize():
try:
new = self.queue.get()
if firstitem:
self.text.delete(1.0, 'end')
firstitem = False
self.text.insert('end', new)
except Queue.Empty:
pass
self.after(1500, self.process_serial)
Regards
Michael
P.S.:
please reply to the list next time, don't worry, I'm subscribed ;)
.-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-.
Time is fluid ... like a river with currents, eddies, backwash.
-- Spock, "The City on the Edge of Forever", stardate
3134.0
_______________________________________________
Tkinter-discuss mailing list
[email protected]
http://mail.python.org/mailman/listinfo/tkinter-discuss