MCPcopy Create free account
hub / github.com/brain-workshop/brainworkshop / update

Method update

brainworkshop.py:3120–3144  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3118 anchor_x='left', anchor_y='center', batch=batch)
3119 self.update()
3120 def update(self):
3121 if not 'arithmetic' in mode.modalities[mode.mode] or not mode.started:
3122 self.label.text = ''
3123 return
3124 if mode.started and mode.hide_text:
3125 self.label.text = ''
3126 return
3127
3128 self.label.font_size=calc_fontsize(16)
3129 str_list = []
3130 str_list.append(_('Answer: '))
3131 str_list.append(str(self.parse_answer()))
3132 self.label.text = ''.join(str_list)
3133
3134 if cfg.SHOW_FEEDBACK and mode.show_missed:
3135 result = check_match('arithmetic')
3136 if result == _('correct'):
3137 self.label.color = cfg.COLOR_LABEL_CORRECT
3138 self.label.bold = True
3139 if result == _('incorrect'):
3140 self.label.color = cfg.COLOR_LABEL_INCORRECT
3141 self.label.bold = True
3142 else:
3143 self.label.color = cfg.COLOR_TEXT
3144 self.label.bold = False
3145
3146 def parse_answer(self):
3147 chars = ''.join(self.answer)

Callers 3

__init__Method · 0.95
inputMethod · 0.95
reset_inputMethod · 0.95

Calls 3

parse_answerMethod · 0.95
calc_fontsizeFunction · 0.85
check_matchFunction · 0.85

Tested by

no test coverage detected