Control Refs declarations #185
-
In the Flet documentation, the Getting started section of the Python Guide also discusses Control Refs. I understand the rationale behind Control Refs and how they are used. But, as a beginner, what a Control Ref declaration is supposed to mean in Python eludes me. For example, in this code: first_name = Ref[TextField]() is the right hand side of the assignment indexing a |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Looks like a good article: https://medium.com/@steveYeah/using-generics-in-python-99010e5056eb |
Beta Was this translation helpful? Give feedback.
Ref
is a generic type. Take a look at its sources: https://github.com/flet-dev/flet/blob/main/sdk/python/flet/ref.pyRef[TextField]()
in Python means the same asList<string>()
in C#. Well, in Python it's just for type hinting, so IDE know what members to show when you typefirst_name.current.
:)Looks like a good article: https://medium.com/@steveYeah/using-generics-in-python-99010e5056eb