terminalwriter.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:godot-python 作者: touilleMan 项目源码 文件源码
def get_terminal_width():
    height = width = 0
    try:
        height, width = _getdimensions()
    except py.builtin._sysex:
        raise
    except:
        # pass to fallback below
        pass

    if width == 0:
        # FALLBACK:
        # * some exception happened
        # * or this is emacs terminal which reports (0,0)
        width = int(os.environ.get('COLUMNS', 80))

    # XXX the windows getdimensions may be bogus, let's sanify a bit
    if width < 40:
        width = 80
    return width
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号