Hi,
I set long string with newlines as a SetValue to my TextCtrl. Say that every 6th substring in every line is supposed to by in center, so all the 6th substrings would be in a column. How do I center it? So far I do it by string.center, but that makes it relative to left side of the page. Any Ideas?
Hi,
I set long string with newlines as a SetValue to my TextCtrl. Say that every 6th substring in every line is supposed to by in center, so all the 6th substrings would be in a column. How do I center it? So far I do it by string.center, but that makes it relative to left side of the page. Any Ideas?
You might try using tabstops (with \t character) instead.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
Hi,
I set long string with newlines as a SetValue to my TextCtrl. Say that every 6th substring in every line is supposed to by in center, so all the 6th substrings would be in a column. How do I center it? So far I do it by string.center, but that makes it relative to left side of the page. Any Ideas?
You might try using tabstops (with \t character) instead.
Well one problem would be that I split my strings to a list and than slice it acc my needs, concate it and send it to TextCtrl.SetValue(...). Say that at each side of my centered string (a word) I have five other words, each of them is, however, of different length. SetValue receives long string with newline chars and every line is centered separately. I also tried tabstops ("%s\t%s\t%s" % (.....)), but the result wasn't good either. The different lenght of strings on each side of the centered string messes it up.
I also tried wx.TE_CENTRE, but problem here is that left and right strings are not the same lenght. Any other ideas? My problem might be little awkward, I know. I was wandering if I couldn't send to SetValue only a string where centered word would be e.g. upper cased and then identify upper case with some wxPython method and center on it? I just could figure out how to do it, if it is possible.
Thanks a lot
Petr
Hi,
I set long string with newlines as a SetValue to my TextCtrl. Say that every 6th substring in every line is supposed to by in center, so all the 6th substrings would be in a column. How do I center it? So far I do it by string.center, but that makes it relative to left side of the page. Any Ideas?
You might try using tabstops (with \t character) instead.
Well one problem would be that I split my strings to a list and than slice it acc my needs, concate it and send it to TextCtrl.SetValue(...). Say that at each side of my centered string (a word) I have five other words, each of them is, however, of different length. SetValue receives long string with newline chars and every line is centered separately. I also tried tabstops ("%s\t%s\t%s" % (.....)), but the result wasn't good either. The different lenght of strings on each side of the centered string messes it up.
I also tried wx.TE_CENTRE, but problem here is that left and right strings are not the same lenght. Any other ideas? My problem might be little awkward, I know. I was wandering if I couldn't send to SetValue only a string where centered word would be e.g. upper cased and then identify upper case with some wxPython method and center on it? I just could figure out how to do it, if it is possible.
I'm still not quite sure what you are trying to do, but I perhaps part of the problem is that the control is using a proportional font by default. Try setting a font with the wx.TELETYPE family, then all chars will have equal width and so if you use spaces for alignment it should work as expected.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!