def setup():
"""
sets environment up and creates main window
:returns: the main window object
"""
# setup the console
mmask = curses.ALL_MOUSE_EVENTS # for now accept all mouse events
main = curses.initscr() # get a window object
y,x = main.getmaxyx() # get size
if y < 24 or x < 80: # verify minimum size rqmts
raise RuntimeError("Terminal must be at least 80 x 24")
curses.noecho() # turn off key echoing
curses.cbreak() # turn off key buffering
curses.mousemask(mmask) # accept mouse events
initcolors() # turn on and set color pallet
main.keypad(1) # let curses handle multibyte special keys
main.clear() # erase everything
banner(main) # write the banner
mainmenu(main) # then the min and menu
main.attron(CPS[RED]) # make the border red
main.border(0) # place the border
main.attroff(CPS[RED]) # turn off the red
curses.curs_set(0) # hide the cursor
main.refresh() # and show everything
return main
评论列表
文章目录