Ability to set the display font of the python output (stdout) to fixed width logical fonts - e.g. "monospaced"

Stuart Beesley (Mr Toolbox)'s Avatar

Stuart Beesley (Mr Toolbox)

17 Nov, 2020 01:50 PM

I believe the Python output area uses this font:
java.awt.Font[family=Gill Sans,name=Gill Sans,style=plain,size=14] >> (derived from GUI .getFonts().mono)

However, this is no good for scripts that try to display column aligned text to stdout (the console display) using print.... I believe this font is not fixed width, so 10 spaces is much smaller than 10 Ws for example.

When calling javax.swing you can of course use .setFont() and setFont(Font("monospaced", Font.PLAIN, 12) works very well as it's fixed width characters using a logical font that works on all platforms...

Is there a way within the script to change the Python console display stdout display text format to use this logical font?

If not, please can we have an option to do this?

Thanks
So, PLEASE can

  1. Support Staff 1 Posted by Sean Reilly on 17 Nov, 2020 02:52 PM

    Sean Reilly's Avatar

    Hi Stuart,

    Sure... for some reason we were using the "Gill Sans" font instead of the more abstract "monospaced" font. In python you can change the UI monospaced font setting with:

    com.moneydance.apps.md.view.gui.MDFonts.mono = Font(Font.MONOSPACED, Font.PLAIN, 12)

    Please let me know if you have any trouble with that. I've changed the default setting for the next update to that font too.

    Thanks,
    Sean

  2. 2 Posted by Stuart Beesley ... on 17 Nov, 2020 02:56 PM

    Stuart Beesley (Mr Toolbox)'s Avatar

    Hi Sean, thanks for this... However, it doesn't work - error below:

    AttributeError: set instance variable as static:
    public java.awt.Font com.moneydance.apps.md.view.gui.MDFonts.mono

    ??

  3. 3 Posted by Stuart Beesley ... on 24 Nov, 2020 07:03 AM

    Stuart Beesley (Mr Toolbox)'s Avatar

    PS - Better make it size 15 as 12 is not very readable.. In fact do you think there is a better one than MONOSPACED as it's quite faint/grey? Thx

  4. 4 Posted by Stuart Beesley ... on 10 Dec, 2020 02:31 PM

    Stuart Beesley (Mr Toolbox)'s Avatar

    This has now been fixed and the moneybot font is monospaced in 2021.2012

  5. Stuart Beesley (Mr Toolbox) closed this discussion on 10 Dec, 2020 02:31 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