I am struggling to find a way so that my wxPython based application would display column based outputs nicely into TextCtrl areas. I would like to get something like this:
Basically, for some reason the spacing between elements of columns is changed.
Now, I know this is probably an application dependent behavior, I get the same messed up output when pasting into Word. I do get the proper one when pasting into notepad like applications, so probably there is a certain mechanism integrated into those that takes care of formatting. I’m not an expert on text formatting, neither in wxPython, but it would really be great if I could manage to achieve this somehow.
Could you point me to any documentation or other ideas that might help?
You sure you want to use a TextCtrl for that, looks to me to be a better fit to use one of the ListCtrl things (e.g. wx.ListCtrl, dataview.ListCtrl, agw.HyperTreeList, agw.UltimateListCtrl), check out the wxPython demo.
Werner
···
On 10/17/2014 16:05, Neamtu Dan wrote:
Hi all,
I am struggling to find a way so that my wxPython based application would display column based outputs nicely into TextCtrl areas. I would like to get something like this:
Basically, for some reason the spacing between elements of columns is changed.
Now, I know this is probably an application dependent behavior, I get the same messed up output when pasting into Word. I do get the proper one when pasting into notepad like applications, so probably there is a certain mechanism integrated into those that takes care of formatting. I'm not an expert on text formatting, neither in wxPython, but it would really be great if I could manage to achieve this somehow.
Could you point me to any documentation or other ideas that might help?
I am struggling to find a way so that my wxPython based application
would display column based outputs nicely into TextCtrl areas. I would
like to get something like this:
Basically, for some reason the spacing between elements of columns is
changed.
Are you aware of the different between a proportional font and a
fixed-pitch font? If you really want to do your spacing like this, you
either need to draw the text yourself instead of using a control, or you
need to use a fixed-pitch font like Courier or Consolas.
I would agree with Werner that this kind of information seems much
better suited to a grid control or a list view control. It's very
difficult to manage and maintain spacing in a text control.
···
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
This seems to be more of a Python string-formatting question, more than a wxPython widget question. Ask google something like: Python print columns. Something I looked at a while ago was:
Then as others said, you would want to use a mono-space font. I’m not sure if you’d need to use a Rich style on the TextCtrl to change the font or not, but once you get the strings formatted correctly it should behave pretty much the same as text printed to a console window.
···
On Friday, October 17, 2014 7:05:21 AM UTC-7, Neamtu Dan wrote:
Hi all,
I am struggling to find a way so that my wxPython based application would display column based outputs nicely into TextCtrl areas. I would like to get something like this:
Neamtu Dan wrote:
>
> I am struggling to find a way so that my wxPython based application
> would display column based outputs nicely into TextCtrl areas.
If you really want to do your spacing like this, you
either need to draw the text yourself instead of using a control, or you
need to use a fixed-pitch font like Courier or Consolas.
Exactly -- the easy way is a fixed-pitch font, you should be able to get
one on any platform with wx.MODERN for the font Family:
better suited to a grid control or a list view control. It's very
difficult to manage and maintain spacing in a text control.
or wxHTML, and make an html table, if this is just for display.
-Chris
···
On Fri, Oct 17, 2014 at 9:41 AM, Tim Roberts <timr@probo.com> wrote:
--
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
better suited to a grid control or a list view control. It’s very
difficult to manage and maintain spacing in a text control.
or wxHTML, and make an html table, if this is just for display.
-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
Fix - change the font. Simple solution, but hard to figure out. Thanks!
···
On Friday, October 17, 2014 4:05:21 PM UTC+2, Neamtu Dan wrote:
Hi all,
I am struggling to find a way so that my wxPython based application would display column based outputs nicely into TextCtrl areas. I would like to get something like this:
Basically, for some reason the spacing between elements of columns is changed.
Now, I know this is probably an application dependent behavior, I get the same messed up output when pasting into Word. I do get the proper one when pasting into notepad like applications, so probably there is a certain mechanism integrated into those that takes care of formatting. I’m not an expert on text formatting, neither in wxPython, but it would really be great if I could manage to achieve this somehow.
Could you point me to any documentation or other ideas that might help?