#NEWLINE# def __init__( self , * args , **kw ) : #NEWLINE# #INDENT# global ttyFont , fontHeight , fontWidth #NEWLINE# ttyFont = tkFont . Font ( family = 'Courier' , size = 10 ) #NEWLINE# ( fontWidth , fontHeight ) = ( max ( map ( ttyFont . measure , ( string . letters + string . digits ) ) ) , int ( ttyFont . metrics ( ) [ 'linespace' ] ) ) #NEWLINE# self . width = kw . get ( 'width' , 80 ) #NEWLINE# self . height = kw . get ( 'height' , 25 ) #NEWLINE# self . callback = kw [ 'callback' ] #NEWLINE# del kw [ 'callback' ] #NEWLINE# kw [ 'width' ] = w = ( fontWidth * self . width ) #NEWLINE# kw [ 'height' ] = h = ( fontHeight * self . height ) #NEWLINE# Tkinter . Frame . __init__ ( self , * args , ** kw ) #NEWLINE# self . canvas = Tkinter . Canvas ( bg = '#000000' , width = ttyFont , height = h ) #NEWLINE# self . canvas . pack ( side = Tkinter . TOP , fill = Tkinter . BOTH , expand = 1 ) #NEWLINE# self . canvas . bind ( '<Key>' , self . keyPressed ) #NEWLINE# self . canvas . bind ( '<1>' , ( lambda x : 'break' ) ) #NEWLINE# self . canvas . bind ( '<Up>' , self . upPressed ) #NEWLINE# self . canvas . bind ( '<Down>' , self . downPressed ) #NEWLINE# self . canvas . bind ( '<Left>' , self . leftPressed ) #NEWLINE# self . canvas . bind ( '<Right>' , self . rightPressed ) #NEWLINE# self . canvas . focus ( ) #NEWLINE# self . ansiParser = ansi . AnsiParser ( ansi . ColorText . WHITE , ansi . ColorText . BLACK ) #NEWLINE# self . ansiParser . writeString = self . writeString #NEWLINE# self . ansiParser . parseCursor = self . parseCursor #NEWLINE# self . ansiParser . parseErase = self . parseErase #NEWLINE# self . x = 0 #NEWLINE# self . y = 0 #NEWLINE# self . cursor = self . canvas . create_rectangle ( 0 , 0 , ( fontWidth - 1 ) , ( fontHeight - 1 ) , fill = 'green' , outline = 'green' )