[pygtk] draw_text (without pango)

A.T.Hofkamp a.t.hofkamp at tue.nl
Mon Oct 23 20:28:35 WST 2006

Zoltán Kovács wrote:
> I realized that draw_text can only handle a signed 16 bit number for the
> input "x". So, if I give
> draw_text(font,gc,-33000,y,text)
> it won't work (-32000 is OK).
> Is this a pygtk or gdk issue?

Afaik it is an X11 issue, the graphical system under Unix is designed with the 
idea that screen coordinates would never exceed the 2^16 x 2^16 pixels signed 
integer range (which runs from -(2^15) to +(2^15)-1, ie from -32768 to +32767).

  What should I do to handle smaller integers

Redesign the X11 graphical system, and replace all installed X11 servers of 
the world with the improved version.

If that solution seems a bit impractical, you may also ask yourself the 
question why you need such large values (assuming you don't have such large 

I briefly looked at the code, and you seem to write the entire text in one 
draw command with some clipping.
An alternative solution may be to do some pre-processing and chop your string 
into smaller pieces, and draw each string seperately (and not drawing text 
which is completely outside the window).


More information about the pygtk mailing list