-
Notifications
You must be signed in to change notification settings - Fork 0
/
Example.py
48 lines (39 loc) · 1 KB
/
Example.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# Imports
from ETM import *
import sys
# Variables
running = True
# Functions
def print_info():
return m.about()
def changetitle():
usr = input("Enter new title: ")
m.change_title(' %s '% (usr))
m.print_menu()
def add_opt():
option = input("Enter new option: ")
func = input("Enter function that option will execute: ")
ETM.Option(option, func)
m.print_options()
def remove_opt():
usr = input("Enter option name: ")
m.remove_option(str(usr))
m.print_options()
def clear_opt():
m.clear_option()
m.print_all()
def exitapp():
return sys.exit(0)
# Main
m = ETM.Menu(' MyApp ','-', 10)
ETM.Option('Print info', print_info)
ETM.Option('Change title', changetitle)
ETM.Option('Create an option', add_opt)
ETM.Option('Delete an option', remove_opt)
ETM.Option('Clear options', clear_opt)
ETM.Option('Exit', exitapp)
m.print_all()
while running == True:
m.get_input()