def create_menu(menu=[], position=[0,0], title='Untitled', format_str='$k: $v', padding=MENU_PADDING,
                on_select=None, on_change=None, on_close=None, on_move=None, dim=True, alignment='', action=None,
                close_on_select=False):
	_menu = {'settings': {'position': list(position),'title': title,'padding': padding,'dim': dim,'format': format_str},
		'on_select': on_select,
		'on_change': on_change,
		'on_move': on_move,
		'on_close': on_close,
		'close_on_select': close_on_select,
		'alignment': alignment,
		'index': 0,
		'values':{},
		'action':action}
		
	#TODO: Does this need to be copied?
	_menu['menu'] = menu[:]
	_size = [len(title),len(_menu['menu'])+2+(_menu['settings']['padding'][1]*2)]
	
	_uid = 0
	for entry in _menu['menu']:
		entry['uid'] = _uid
		_uid+=1
		
		for value in range(len(entry['values'])):
			_line = format_entry(_menu['settings']['format'], entry, value=value)
			
			if len(_line) > _size[0]:
				_size[0] = len(_line)
	
	_menu['settings']['size'] = (_size[0]+(_menu['settings']['padding'][0]*2),_size[1])
	_menu['settings']['console'] = tcod.console_new(_menu['settings']['size'][0],_menu['settings']['size'][1])
	
	MENUS.append(_menu)
	
	return MENUS.index(_menu)
dataset/ETHPy150Open flags/Reactor-3/menus.py/create_menu/original