On 6/5/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>  I'm trying to write a simple text editor in pyglet as an exercise.
>  Everything has worked fine so far, including moving the cursor,
>  inserting/deleting text, etc. However, when I press the Return key, a
>  space character is passed to on_text(). If I hit Enter, no character
>  is passed at all.
>
>  Mac OS X 10.5.2, pyglet 1.1b1
>
>  My function:
>  def on_text(self,text):
>         self.text_area.begin_update()
>         self.text_area.document.insert_text(self.cursor,text)
>         self.cursor += len(text)
>         self.text_area.end_update()

Try the examples/events.py program, to make sure you're not just
misprinting the '\r' character that's generated.  You'll need to
convert this '\r' into a '\n' for display in a multiline TextLayout.

(Just in case you're unaware, the Caret class provides all of this
functionality).

Alex.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to