#!/usr/bin/env python ## CURSES BASIC-MAIL GUI # This is the Basic-Mail program, a basic email client written in python # with a curses interface. # # To Run: Go to the Basic-Mail directory and type "python Basic-Mail.py", # without the quotes. # If it doesn't open, make sure that the size of the console window # is at least 80 x 30 pixels. ## ## Filename: menu.py ## # This file contains functions that deal with, guess what, menus! ## ## IMPORTS ## import curses, curses.ascii, curses.panel # Curses imports import traceback, os, sys, select, string # Random imports from variables import * # Imports all variables from draw import * # Imports the window drawing functions ## Function: Creates a menu window below the user selected option. ## Returns the menu window's panel. def create_menu(list,location): x = 2 y = 2 height = 0 width = 0 for number in list[0][0:location]: x += len(number) + 2 location = (location * 2) + 2 for number in list[location]: if len(number) > width: width = len(number) height += 1 width += 2 # Accounts for borders height += 1 # Again for borders menu_win = curses.newwin(height,width,y,x) menu_panel = curses.panel.new_panel(menu_win) # Begin drawing menu y = 0 x = 0 draw_borders(menu_win,width,height) for number in list[location]: menu_win.addstr(y,x+1,number) menu_win.addch(y,list[location+1][y]+1,number[list[location+1][y]],\ curses.color_pair(3)) y += 1 menu_win.refresh() return menu_panel