def get_focus(self):
        """Perform setups and get focus to itself.

        "Getting focus" means assuming control of the
        application loop.
        """
        ### assign behaviours

        self.update = self.update_focused
        self.draw = self.draw_focused
        self.handle_input = self.handle_events

        ### if app is not in play mode, enable text editing events
        ### and set the text input rect

        if GENERAL_NS.mode_name != 'play':

            start_text_input()
            set_text_input_rect(self.rect.move(0, 20))

        ### align line topleft with self.rect.topleft and
        ### move cursor to the end of the contents

        self.cursor.line.rect.topleft = self.rect.topleft
        self.cursor.go_to_end()

        ### store topleft left position for later
        ### reference if needed
        self.last_topleft = self.rect.topleft

        ### give focus to self by raising a manager switch
        ### exception with a reference to this widget
        raise SwitchLoopException(self)
Perform setups and get focus to itself.

        "Getting focus" means assuming control of the
        application loop.
        
nodezator/widget/stringentry.py