Please change MoneyBot Console to use a fixed-width font

magellan's Avatar

magellan

21 Aug, 2019 03:37 PM

Hello,

This is a minor issue but it might cause other noobs considerable frustration like it did me.

I'm new to Python and was trying to get some MoneyBot console script output to appear in a tabular format with the numbers in each column right-aligned. No matter what I tried, I couldn't get python to right-justify the columns in my tabular output (using python's print/format feature)

The problem turned out to be that the default font used in the MoneyBot console window has proportional-width characters rather than fixed width characters. This means that even though my output was properly converted to fixed-width strings that were properly right-justified, when each output line is rendered in the console window, different characters use a different amount of space and this causes the output to be misaligned.

If I cut/paste the console window output from my script to another editor that uses a fixed width font, each line renders in the editor with all data perfectly right-aligned in nice neat columns as I originally intended.

Here's the python code that produced the output:
            print (' {0:s}\t${1:.2f}\t{2:*>12,.2f} \t{3:*>12,.2f}\t{4:*>12.2f}'.
               format(l.date.strftime("%m/%d/%y"),l.buyPrice,l.availableShares,l.costBasis,l.currentPrice))

I think it might be better if the default font in the console output window was a fixed-width font so tabular output will render with the intended alignment.

Thanks!

  1. 1 Posted by magellan on 21 Aug, 2019 03:39 PM

    magellan's Avatar
  2. System closed this discussion on 20 Nov, 2019 03:40 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac