2

I am getting an error when I access the value of a TextField to perform a sum operation with that number. My code is as follows:

txt_number = ft.TextField(value="1", text_align=ft.TextAlign(value="center"), width=100)     

def minus_click(e):
    txt_number.value = str(int(txt_number.value) - 1)
    page.update()

the error I get in the console is the following:

Argument of type "str | None" cannot be assigned to parameter "__x" of type "ReadableBuffer | str | SupportsInt | SupportsIndex | SupportsTrunc" in function "new"   Type "str | None" cannot be assigned to type "ReadableBuffer | str | SupportsInt | SupportsIndex | SupportsTrunc"     Type "None" cannot be assigned to type "ReadableBuffer | str | SupportsInt | SupportsIndex | SupportsTrunc"       Type "None" cannot be assigned to type "str"       Type "None" cannot be assigned to type "ReadOnlyBuffer"       Type "None" cannot be assigned to type "bytearray"       Type "None" cannot be assigned to type "memoryview"       Type "None" cannot be assigned to type "array[Any]"       Type "None" cannot be assigned to type "mmap" ...

I tried the example from Flet's counter documentation and got the same error. I even copied and pasted just the example and it still sent that problem in the console.

I have already checked that there was no error when trying to cast between a str and an integer. I think it is a Flet error.

cabh_000
  • 21
  • 1

0 Answers0