Linux and windows use different types of line breaks. Linux uses \n and Windows 
\r\n (And mac \r I believe).
So I think you should add an extra \r when your program is run on Windows and 
the user hits enter.

I don't know why Textview doesn't do that itself. I'm a pygtk beginner myself...

Regards,
Leon


________________________________________
From: pygtk-boun...@daa.com.au [pygtk-boun...@daa.com.au] on behalf of James 
Simmons [nices...@gmail.com]
Sent: Friday, December 10, 2010 01:39
To: PyGTK Mailing List
Subject: [pygtk] Problem with gtk.TextView in Windows, but not in Linux

I have written a simple program for proofing and correcting OCR'd text
that I'm going to include in a book I'm writing about making e-books.
The program has a left pane and a right pane.  The left pane is a
gtk.TextView and the right pane is a gtk.Image.  The idea is that the
left pane shows the OCR'd text created from the image in the right
pane.  You use the text view to make corrections to the text and save
them.   You can see the code here:

http://git.sugarlabs.org/e-book-making-scripts/mainline/blobs/master/proofer.py

This program works flawlessly in Linux, but not in Windows.  In
Windows everything works *except* when you hit the Enter key in the
TextView.  It does not insert a new line.  What's odd is that if you
look at a file edited with the program in Windows in Linux then you DO
see the inserted lines, so they are going into the text buffer but the
TextView does not show them.  Every other key works just fine in
Windows.  It's just the Enter key that's messed up.

I'm using the very latest Python plus the very latest PyGTK, Cairo,
PyGObject, and GTK+ bundle.

If anyone has ideas on how to work around this I'd sure like to hear
them.  For myself I can use the program under Linux, but I want my
readers to be able to use it under Windows and the Mac as well.

James Simmons
_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/
_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to