GRSISort
Created by P.C. Bender
Developement Team: P.C. Bender, R. Dunlop, V. Bildstein
An extension of the ROOT analysis Framework
pygui.AnsiColorText.AnsiColorText Class Reference

  class to convert text with ansi color codes to
  text with tkinter color tags

  for now we ignore all but the simplest color directives
  see http://www.termsys.demon.co.uk/vtansi.htm for a list of
  other directives

  it has not been thoroughly tested, but it works well enough for demonstration purposes

Definition at line 6 of file AnsiColorText.py.

Public Member Functions

def __init__ (self, args, kwargs)
 
def register_tag (self, txt, foreground, background)
 
def reset_to_default_attribs (self)
 
def write (self, text, is_editable=False)
 

Public Attributes

 backgroundcolor
 
 bright
 
 foregroundcolor
 
 known_tags
 
 tag
 

Static Public Attributes

dictionary background_colors
 
 color_pat = re.compile('\x01?\x1b\[([\d+;]*?)m\x02?')
 
dictionary foreground_colors
 
 inner_color_pat = re.compile("^(\d+;?)+$")
 
+ Inheritance diagram for pygui.AnsiColorText.AnsiColorText:
+ Collaboration diagram for pygui.AnsiColorText.AnsiColorText:

Constructor & Destructor Documentation

◆ __init__()

def pygui.AnsiColorText.AnsiColorText.__init__ (   self,
  args,
  kwargs 
)
    initialize our specialized tkinter Text widget

Definition at line 68 of file AnsiColorText.py.

Member Function Documentation

◆ register_tag()

def pygui.AnsiColorText.AnsiColorText.register_tag (   self,
  txt,
  foreground,
  background 
)
    register a tag with name txt and with given
    foreground and background color

Definition at line 84 of file AnsiColorText.py.

References pygui.AnsiColorText.AnsiColorText.known_tags.

Referenced by pygui.AnsiColorText.AnsiColorText.write().

◆ reset_to_default_attribs()

def pygui.AnsiColorText.AnsiColorText.reset_to_default_attribs (   self)

Definition at line 78 of file AnsiColorText.py.

Referenced by pygui.AnsiColorText.AnsiColorText.write().

◆ write()

Member Data Documentation

◆ background_colors

dictionary pygui.AnsiColorText.AnsiColorText.background_colors
static
Initial value:
= {
'bright' : {
'40' : 'Black',
'41' : 'Red',
'42' : 'Green',
'43' : 'Brown',
'44' : 'Blue',
'45' : 'Purple',
'46' : 'Cyan',
'47' : 'White'
},
'dim' : {
'40' : 'DarkGray',
'41' : 'LightRed',
'42' : 'LightGreen',
'43' : 'Yellow',
'44' : 'LightBlue',
'45' : 'Magenta',
'46' : 'Pink',
'47' : 'White'
}
}

Definition at line 40 of file AnsiColorText.py.

◆ backgroundcolor

pygui.AnsiColorText.AnsiColorText.backgroundcolor

Definition at line 82 of file AnsiColorText.py.

Referenced by pygui.AnsiColorText.AnsiColorText.write().

◆ bright

pygui.AnsiColorText.AnsiColorText.bright

Definition at line 80 of file AnsiColorText.py.

Referenced by pygui.AnsiColorText.AnsiColorText.write().

◆ color_pat

pygui.AnsiColorText.AnsiColorText.color_pat = re.compile('\x01?\x1b\[([\d+;]*?)m\x02?')
static

Definition at line 65 of file AnsiColorText.py.

◆ foreground_colors

dictionary pygui.AnsiColorText.AnsiColorText.foreground_colors
static
Initial value:
= {
'bright' : {
'30' : 'Black',
'31' : 'Red',
'32' : 'Green',
'33' : 'Brown',
'34' : 'Blue',
'35' : 'Purple',
'36' : 'Cyan',
'37' : 'White'
},
'dim' : {
'30' : 'DarkGray',
'31' : 'LightRed',
'32' : 'LightGreen',
'33' : 'Yellow',
'34' : 'LightBlue',
'35' : 'Magenta',
'36' : 'Pink',
'37' : 'White'
}
}

Definition at line 17 of file AnsiColorText.py.

◆ foregroundcolor

pygui.AnsiColorText.AnsiColorText.foregroundcolor

Definition at line 81 of file AnsiColorText.py.

Referenced by pygui.AnsiColorText.AnsiColorText.write().

◆ inner_color_pat

pygui.AnsiColorText.AnsiColorText.inner_color_pat = re.compile("^(\d+;?)+$")
static

Definition at line 66 of file AnsiColorText.py.

◆ known_tags

pygui.AnsiColorText.AnsiColorText.known_tags

◆ tag

pygui.AnsiColorText.AnsiColorText.tag

Definition at line 79 of file AnsiColorText.py.

Referenced by pygui.AnsiColorText.AnsiColorText.write().