to get screen size, use curses:

import curses
curses.setupterm()

lines = curses.tigetnum('lines')
cols = curses.tigetnum('cols')

curses also has functions for other graphical operations