X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=m_lib%2Ftty_menu.py;h=897ecc9a8b2764ef02c1db51f4f03bbaef39152d;hb=fb3af94919a9ee18ba1c35f927f19837f057fa1f;hp=35ba43d1ba49d5db64763f6c0105c4e4ecb238fd;hpb=d7c459a9f979c4978cf07ff11056512a852fd61d;p=m_lib.git diff --git a/m_lib/tty_menu.py b/m_lib/tty_menu.py index 35ba43d..897ecc9 100755 --- a/m_lib/tty_menu.py +++ b/m_lib/tty_menu.py @@ -1,10 +1,8 @@ #! /usr/bin/env python -"""tty menus - - Written by Broytman, Mar 1998. Copyright (C) 1997 PhiloSoft Design. -""" +"""tty menus""" +from __future__ import print_function import string @@ -28,7 +26,7 @@ def vmenu(item_list, prompt, format = "%d. %s"): returns selected number. Returns -1, if user enter non-numeric string. """ for i in range(len(item_list)): - print format % (i, item_list[i]) + print(format % (i, item_list[i])) print result = raw_input(prompt) @@ -43,14 +41,14 @@ def vmenu(item_list, prompt, format = "%d. %s"): def test(): result = hmenu("Select: d)aily, w)eekly, m)onthly, c)ancel: ", "dwmc") - print "Answer is '%s'\n" % result + print("Answer is '%s'\n" % result) os_list = ["DOS", "Windows", "UNIX"] result = vmenu(os_list, "Select OS: ") if 0 <= result < len(os_list): - print "Answer is '%s'\n" % os_list[result] + print("Answer is '%s'\n" % os_list[result]) else: - print "Wrong selection" + print("Wrong selection") if __name__ == "__main__": test()