コード例 #1
0
ファイル: proc.py プロジェクト: gridl/bestia
 def banner(self, msg='', sep='\\', lead_lines=0, trail_lines=0):
     msg = f"[{self.command}]{msg} "
     c = 0
     if len(msg) < tty_cols():
         c = tty_cols() - len(msg)
     for _ in range(lead_lines):
         print()
     print(f"{msg}{sep*c}")
     for _ in range(trail_lines):
         print()
コード例 #2
0
def max_frets_on_screen():
    ''' calculates how may frets can be rendered without exceeding terminal size
        will NOT go over MAX_FRETS
    '''
    frets = int(tty_cols() / (_NOTE_WIDTH + _FRET_WIDTH)) - 2
    return frets if frets < MAX_FRETS else MAX_FRETS