Skip to content

Instantly share code, notes, and snippets.

@macagua
Created February 3, 2013 16:09
Show Gist options
  • Save macagua/4702326 to your computer and use it in GitHub Desktop.
Save macagua/4702326 to your computer and use it in GitHub Desktop.
Demo of a main menu for choose a option from a Python script.
# -*- coding: utf8 -*-
def menu():
''' Main menu to choose an item '''
chosen_element = 0;
print "#############################################################################"
print "######## ########"
print "######## My Company Super Client Number 1' ########"
print "######## ----------------------------------------------------------- ########"
print "######## Customer relationship management for Super Client Number 1 ########"
print "######## ----------------------------------------------------------- ########"
print "######## ########"
print "######## Choose a option: ########"
print "######## ########"
print "######## 1) Add a Customer | 2) Search a Customer ########"
print "######## 3) Update Customers | 4) Delete a Customer ########"
print "######## 5) Exit ########"
print "######## ########"
print "#############################################################################"
chosen_element = input("Enter a number from 1 to 5: ")
if int(chosen_element) == 1:
print('Adding a Customer!!!')
elif int(chosen_element) == 2:
print('Searching a Customer!!!')
elif int(chosen_element) == 3:
print('Update Customers!!!')
elif int(chosen_element) == 4:
print('Delete a Customer!!!')
elif int(chosen_element) == 5:
sys.exit()
else:
print('Sorry, the value entered must be a number from 1 to 5, then try again!')
if __name__ == '__main__':
''' Python script main function '''
menu()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment