Exemple #1
0
    def __init__(
            self,
            length,
            valid_chars=DEFAULT_VALID_CHARS,
            unfocus_keys=(ESCAPE, RETURN, TAB),
            unfocus_handler=lambda k: None,
            backspace_key=BACKSPACE,
            style=style.Style(),
            *args,
            **kwargs
    ):
        self.length = length
        self.valid_chars = valid_chars

        self.style = style

        self.unfocus_keys = unfocus_keys

        self.backspace_key = backspace_key

        self.text = ""
        self.text_lock = threading.Lock()

        self.unfocus_handler = unfocus_handler

        self._keylistener_stop_event = threading.Event()
        self._keylistener_stop_event.set()

        super(self.__class__, self).__init__(*args, **kwargs)
Exemple #2
0
def Label(text, fore_colour=None, back_colour=None, text_alignment=0):
    """
    Generator for a Label for back compatibility
    :return: Label
    """
    s = style.Style(fore=fore_colour, back=back_colour)
    return widget.Label(text, s, alignment=text_alignment)
Exemple #3
0
    def __init__(self, text, style=style.Style(), *args, **kwargs):
        self.text = text
        self.style = style
        self.index = 0

        super(self.__class__, self).__init__(*args, **kwargs)
Exemple #4
0
 def __init__(self, style=style.Style(), alignment=0):
     self.alignment = alignment
     self.style = style
Exemple #5
0
    print(row)
    print(len(row))

    for char in row:
        print(char)

    for i in range(len(row)):
        print(row[i])
    '''

    tin = TextInput(
        20,
        unfocus_handler=lambda k: print('EXITED WITH KEY:', repr(k)),
        style=style.Style(
            fore=style.foreground.BLUE,
            back=style.background.WHITE#,
            #style=style.BOLD
        )
    )

    print('pre-run')

    print(tin)
    tin.text = 'test'
    #print(tin)

    tin.focus()

    print("Main loop starting...")

    while True: