From 018bc9b182594c67eee66be4f19df10d399de909 Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Mon, 1 Apr 2019 12:23:45 -0700 Subject: [PATCH] Add fancier text bubble with Unicode --- horsay | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/horsay b/horsay index cafbe16..37e75e8 100755 --- a/horsay +++ b/horsay @@ -12,20 +12,22 @@ while len(text) > 61: segments.append(text) max_width = max([len(s) for s in segments]) -lines = ["| {0:{1}} |".format(s, max_width) for s in segments] -text_half = ["", "+-" + "-"*max_width + "-+"] + lines + ["+-" + "-"*max_width + "-+"] +lines = ["\u2502 {0:{1}} \u2502".format(s, max_width) for s in segments] +text_half = ["", "\u256D\u2500" + "\u2500"*max_width + "\u2500\u256E"] + lines + ["\u2570\u2500" + "\u2500"*max_width + "\u2500\u256F"] if len(text_half) > 5: text_half.pop(0) horse_half = [ " ./|,,/| ", " < o o) ", - " <\ ( | --", + " <\ ( | \u2500\u2500", " <\\\ |\ | ", " <\\\\\ |(__) ", "<\\\\\\\ | " ] for i in range(max(len(horse_half), len(text_half))): + if horse_half[i][-1] == '\u2500' and text_half[i][0] == '\u2502': + text_half[i] = '\u2524' + text_half[i][1:] if i < len(horse_half): sys.stdout.write(horse_half[i]) else: