TextCtrl -> inserting aligned text columns

hello,
I am trying to print a string formatted to represent data columns into
TextCtrl such as:

self.databox = wx.TextCtrl(self,-1, "",size=(530,200),style =
wx.TE_MULTILINE)

dstr = " 0.0 1.1\n" +\
    " 12.0 2.6\n" +\
    " 123.0 13.6\n"

self.databox.AppendText(dstr)

With both columns aligned to right with max width I provide. I format
in python but when outputting the string to textctrl the width of the
space character doesn't match the width of other standard characters
(space is shorter). Is there a way to fix this, make a default width
for all characters or something? Or another solution I can implement.
I don't believe I can have a sizer within a textctrl correct?

Hello,

···

On Aug 13, 2009, at 3:55 PM, Matt wrote:

hello,
I am trying to print a string formatted to represent data columns into
TextCtrl such as:

self.databox = wx.TextCtrl(self,-1, "",size=(530,200),style =
wx.TE_MULTILINE)

dstr = " 0.0 1.1\n" +\
    " 12.0 2.6\n" +\
    " 123.0 13.6\n"

self.databox.AppendText(dstr)

With both columns aligned to right with max width I provide. I format
in python but when outputting the string to textctrl the width of the
space character doesn't match the width of other standard characters
(space is shorter). Is there a way to fix this, make a default width
for all characters or something? Or another solution I can implement.
I don't believe I can have a sizer within a textctrl correct?

Its probably because your using a proportional font in the text control, if you want all the characters to be the same width you need to use a fixed width font in the control.

Cody

Ah ok thanks, I guess the default font is proportional.

adding this did it:

self.databox.SetFont(wx.Font(14,wx.TELETYPE,wx.NORMAL,wx.NORMAL))

···

On Aug 13, 2:35 pm, Cody Precord <codyprec...@gmail.com> wrote:

Hello,

On Aug 13, 2009, at 3:55 PM, Matt wrote:

> hello,
> I am trying to print a string formatted to represent data columns into
> TextCtrl such as:

> self.databox = wx.TextCtrl(self,-1, "",size=(530,200),style =
> wx.TE_MULTILINE)

> dstr = " 0.0 1.1\n" +\
> " 12.0 2.6\n" +\
> " 123.0 13.6\n"

> self.databox.AppendText(dstr)

> With both columns aligned to right with max width I provide. I format
> in python but when outputting the string to textctrl the width of the
> space character doesn't match the width of other standard characters
> (space is shorter). Is there a way to fix this, make a default width
> for all characters or something? Or another solution I can implement.
> I don't believe I can have a sizer within a textctrl correct?

Its probably because your using a proportional font in the text
control, if you want all the characters to be the same width you need
to use a fixed width font in the control.

Cody