ChestnutHeng / Wudao-dict

有道词典的命令行版本,支持英汉互查和在线查询。

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

避免在单词内换行

inkss opened this issue · comments

commented

能获取终端大小,在例句显示时不在单词内换行吗?

wd

我在python中用rows, columns = os.popen('stty size', 'r').read().split() 可以获得终端窗口的大小。
然后在 https://github.com/ChestnutHeng/Wudao-dict/blob/master/wudao-dict/src/CommandDraw.py#L78 的sentence中sentence_t对应位置添加换行符。这样做可以换行,但是每一行的长度不能保持一致,看起来很别扭。
我想要两端对齐的效果,不知道如何实现