When I add text to the IncrementalTextLayout, it appears to be showing
up as the bottom line of the ITL's window (which is actually what I
want, but I would expect to have to tell it 'valign=bottom' or
something):

+--------+
+        +
+        +
+ line1  +
+--------+

note that "line1" does not have a newline at the end of it.

If I then append "line2\n" I get:

+--------+
+        +
+        +
+ line1  +
+--------+
  line2

1) there was no newline after line1 -- why did line2 go to a new line?
 (line1 + line2 is much narrower than the width of the ITL)  Perhaps
insert_text pree- or appends
2) line2 is outside the bounds of the box

Then if I drag the mouse, which does:

   incr_layout.x += int(dx)
   incr_layout.y += int(dy)

Then the window becomes:

+--------+
+ line1  +
+ line2  +
+        +
+--------+

So now I'm thoroughly confused.  ???

I've created a complete test case below, though there's not a nice
border drawn around the ITL like there is in my working code.  Note
that set the ITL to an x,y of 100,00.



import pyglet
from pyglet import font
from pyglet import window

win = window.Window()

ft = font.load('Arial', 36)

incr_layout = pyglet.text.layout.IncrementalTextLayout(
   pyglet.text.document.UnformattedDocument("line1"),
   dpi=72,
   multiline=True,
   width=400,
   height=400)

incr_layout.x = 100
incr_layout.y = 100

global count
count = 0

def update():
   global count
   incr_layout.begin_update()
   if count % 100 == 0:
      incr_layout.document.insert_text(len(incr_layout.document.text),
"%d\n" % count)
   incr_layout.document.set_style(0, len(incr_layout.document.text),
   {'color': (255, 255, 255, 255)})
   incr_layout.end_update()
   count += 1


def on_mouse_drag(x, y, dx, dy, button, modifiers):
   incr_layout.x += int(dx)
   incr_layout.y += int(dy)
win.on_mouse_drag = on_mouse_drag

while not win.has_exit:
    win.dispatch_events()
    update()
    win.clear()
    incr_layout.draw()
    win.flip()

--~--~---------~--~----~------------~-------~--~----~
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