alignment of text in DrawText

Hi Robin,

I believe that there is real value in adding a flag to the DrawText method in order to specify the alignment to the x,y point.

Right now I’m using some hack where I glue to the dc class some extra methods but it would be nicer if the DrawText could receive an alignment parameter defaulting to wx.TOP|wx.LEFT or something like that :slight_smile:

Peter.

···


There is NO FATE, we are the creators.

Peter Damoc wrote:

Hi Robin,

I believe that there is real value in adding a flag to the DrawText method in order to specify the alignment to the x,y point.

Right now I'm using some hack where I glue to the dc class some extra methods but it would be nicer if the DrawText could receive an alignment parameter defaulting to wx.TOP|wx.LEFT or something like that :slight_smile:

Although this would probably be useful I think a more common need would be to align to the font's baseline, and we don't have any alignment flags for that. Anyway enter a feature request, (or a patch if you're feeling adventurous,) for this at the wxWidgets SF page

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

Peter Damoc wrote:

I believe that there is real value in adding a flag to the DrawText method in order to specify the alignment to the x,y point.

Although this would probably be useful I think a more common need would be to align to the font's baseline, and we don't have any alignment flags for that.

They would all be useful! If alignment to the baseline is done, that would be a good time to add other alignments also.

Peter, you might want to take a look at wx.lib.floatcanvas -- the Text object in there has alignment to top|center|bottom, and left>center>right -- it was a bit of a pain to write.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov