Avaiga / taipy

Turns Data and AI algorithms into production-ready web applications in no time.
https://www.taipy.io
Apache License 2.0
10.94k stars 775 forks source link

[πŸ› BUG] f-string syntax not working in lambda expression #1503

Closed FlorianJacta closed 1 month ago

FlorianJacta commented 1 month ago

What went wrong? πŸ€”

Using {} in a lambda expression will result in the visual element not showing up.

Expected Behavior

We should find a way to make it work. If it is impossible, we should have some kind of warning and documentation.

Steps to Reproduce Issue

from taipy.gui import Gui 
import taipy.gui.builder as tgb

value = 10

with tgb.Page() as page:
    # Not working
    tgb.text(value=lambda value: f"1: Value {value}")
    # Not working
    tgb.text(value=lambda value: "2: Value {value}")
    # Works
    tgb.text(value=lambda value: "3: Value " + str(value))
    # Works
    tgb.text("4: Value {value}")

Gui(page=page).run(title="Frontend Demo")

image

Solution Proposed

No response

Screenshots

No response

Runtime Environment

No response

Browsers

Chrome

OS

Windows

Version of Taipy

Develop - 7/11/24

Additional Context

No response

Acceptance Criteria

Code of Conduct

FredLL-Avaiga commented 1 month ago

this is fixed ?

FredLL-Avaiga commented 1 month ago

this is what I get when I run your sample image

FredLL-Avaiga commented 1 month ago

and tgb.text(value=lambda value: f"1: Value {value*2}") render as image

FlorianJacta commented 1 month ago

My bad, it works!

FredLL-Avaiga commented 1 month ago

close it then ?