omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Change font in console

    Pythonista
    3
    4
    2451
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • domiriel
      domiriel last edited by

      There is an option to change the font in the editor. Is there a way to change the font in the console? Programmatically I can do console.set_font(), but even when I use a monospace font such as Courier, something seems off in the way in which it renders spaces (not the same width as the other chars, as it should, being monospace). I often use some "ASCII Art" of sorts for a quick output/debug (and fun :) ) and this makes it that much harder...

      Thanks!
      D.

      Phuket2 1 Reply Last reply Reply Quote 0
      • Phuket2
        Phuket2 @domiriel last edited by

        @domiriel , sorry I don't know the answer to your question. But just in case you didn't know, if you create a file called 'pythonista_startup.py' in the 'site-packages' dir, it will be executed when Pythonista starts up. Just when you get your answer this could be handy for you. My pythonista_startup.py looks like -

        # coding: utf-8
        import sys, os, console
        
        print('my startup script\n')
        from objc_util import *
        UIScreen = ObjCClass('UIScreen')
        from plistlib import readPlist
        
        
        screen = UIScreen.mainScreen()
        screen.setBrightness_(0.25)
        
        UIView.beginAnimations_(None)
        UIView.setAnimationDuration_(0)
        print('switching off animations\n')
        
        print('screen brightness:'.upper(), '{:f}'.format(screen.brightness()))
        
        fnt = ('Menlo', 22) 
        console.set_font(*fnt)
        print('Font set to {}-{}'.format(*fnt))
        
        def pyst_version_str():
            plist = readPlist(os.path.abspath(os.path.join(sys.executable, '..', 'Info.plist')))
            return plist['CFBundleShortVersionString']
        
        print(('Pythonista Version:{}'.format(pyst_version_str())))
        
        1 Reply Last reply Reply Quote 0
        • JonB
          JonB last edited by

          what device/version are you on? I could not repeat what you described.

          print('#'*20+('\n#'+' '*18+'#')*9+'\n'+'#'*20) prints a box.

          1 Reply Last reply Reply Quote 0
          • domiriel
            domiriel last edited by

            It does!

            I found what I had messed up: having pasted some code from another place (I had originally written it in the desktop), it brought along some tabs mixed in with spaces (some tool along the way messed those up) and I didn't notice it in the editor, only in the console (different fonts, due to all the experimentation).

            So, all in all, a completely noob mistake from someone programming in Python for 20 years :/

            Thanks for such quick assistance!

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB Forums | Contributors