-
Notifications
You must be signed in to change notification settings - Fork 0
/
justmessage.py
executable file
·35 lines (28 loc) · 969 Bytes
/
justmessage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python3
from tkinter import *
PROG = 'justmessage'
def main(*, message, font, font_size, title):
root = Tk()
root.wm_title(title)
label = Label(root, text=message, font='{} {}'.format(font, font_size))
label.pack()
root.mainloop()
def set_terminal_caption(caption=None):
import sys
if caption is None:
caption = sys.argv[0].rpartition('/')[2]
sys.stdout.write('\033]2;' + caption + '\007')
sys.stdout.flush()
if __name__ == '__main__':
set_terminal_caption(PROG)
import argparse
parser = argparse.ArgumentParser(prog=PROG,
description='just display a message' )
parser.add_argument('message')
parser.add_argument('-F', '--font', default='Sans')
parser.add_argument('-f', '--font-size', type=int,
default=100,
help='label font size' )
parser.add_argument('-t', '--title', default='just a message')
args = parser.parse_args()
main(**vars(args))