flet-dev / flet

Flet enables developers to easily build realtime web, mobile and desktop apps in Python. No frontend experience required.
https://flet.dev
Apache License 2.0
11.61k stars 455 forks source link

when run code is running as expected when i build it to windows the app is not run disabled not run why #4023

Closed smfd99 closed 2 months ago

smfd99 commented 2 months ago

Duplicate Check

Describe the bug

when run code is running as expected when i build it to windows the app is not run disabled not run why

Code sample

Code ```python import flet as ft import flet as ft from flet import * from flet_route import * def main(page: ft.Page): def search_values_on_chage(self): search_values.clear() values = self.control.value.split('\n') search_values.extend(values) print("All search values are:", search_values) page.update() return search_values snack_bar = ft.SnackBar( content=ft.Text("Hello, world!",size=30), action="Alright!", bgcolor='green', ) page.overlay.append(snack_bar) def snack_bar_on_change(e,text:str,bgcolor:str): snack_bar.content = ft.Text(text,size=30) snack_bar.bgcolor=bgcolor snack_bar.open = True page.update() def button_clicked(e): print(dropdown_choies.value) snack_bar_on_change(e,f'Your : {dropdown_choies.value}','blue') if dropdown_choies.value == '2': Start_date.disabled=False End_date.disabled=False search_field.disabled=True search_field.disabled=True search_field.value=None page.update() else: Start_date.disabled=True Start_date.value=None End_date.disabled=True End_date.value=None search_field.disabled=False search_field.disabled=False page.update() page.update() dropdown_choies = ft.Dropdown( on_change=button_clicked, label='search value', icon=icons.SEARCH, color='blue', helper_text='choose from list', border_color='transparent',focused_border_color='blue', options=[ ft.dropdown.Option('1'), ft.dropdown.Option('2'), ], width=250, ) Start_date=ft.TextField(width=250,label='start',icon=icons.SEARCH,color='blue', helper_text='first date',border_color='transparent',focused_border_color='blue',disabled=True) End_date=ft.TextField(width=250,label='end',icon=icons.SEARCH,color='blue', helper_text='last date',border_color='transparent',focused_border_color='blue',disabled=True) search_values = [] ########################################################################################################################################## search_field=ft.TextField( height=80, width=500, icon=icons.SEARCH, label="search", multiline=True, min_lines=1, max_lines=3, hint_text='search numbers', color='blue', border_color='transparent',focused_border_color='blue', on_change=search_values_on_chage, ) page.add(search_field, dropdown_choies, Start_date, End_date, ) ft.app(main)

To reproduce

import flet as ft import flet as ft from flet import from flet_route import

def main(page: ft.Page): def search_values_on_chage(self): search_values.clear() values = self.control.value.split('\n') search_values.extend(values) print("All search values are:", search_values) page.update() return search_values snack_bar = ft.SnackBar( content=ft.Text("Hello, world!",size=30), action="Alright!", bgcolor='green', ) page.overlay.append(snack_bar) def snack_bar_on_change(e,text:str,bgcolor:str): snack_bar.content = ft.Text(text,size=30) snack_bar.bgcolor=bgcolor snack_bar.open = True page.update() def button_clicked(e): print(dropdown_choies.value) snack_bar_on_change(e,f'Your : {dropdown_choies.value}','blue') if dropdown_choies.value == '2': Start_date.disabled=False End_date.disabled=False search_field.disabled=True search_field.disabled=True search_field.value=None page.update() else: Start_date.disabled=True Start_date.value=None End_date.disabled=True End_date.value=None search_field.disabled=False search_field.disabled=False page.update()

    page.update()
dropdown_choies = ft.Dropdown(
      on_change=button_clicked,
      label='search value',
      icon=icons.SEARCH,
      color='blue',
      helper_text='choose from list',
      border_color='transparent',focused_border_color='blue',
      options=[
          ft.dropdown.Option('1'),
          ft.dropdown.Option('2'),
      ],
      width=250,

)
Start_date=ft.TextField(width=250,label='start',icon=icons.SEARCH,color='blue', helper_text='first date',border_color='transparent',focused_border_color='blue',disabled=True)
End_date=ft.TextField(width=250,label='end',icon=icons.SEARCH,color='blue', helper_text='last date',border_color='transparent',focused_border_color='blue',disabled=True)
search_values = []
##########################################################################################################################################

search_field=ft.TextField(
                            height=80,
                            width=500,
                            icon=icons.SEARCH,
                            label="search",
                            multiline=True,
                            min_lines=1,
                            max_lines=3,
                            hint_text='search numbers',
                            color='blue',
                            border_color='transparent',focused_border_color='blue',
                            on_change=search_values_on_chage,

                        )                              
page.add(search_field,
        dropdown_choies,
         Start_date,
         End_date,
         )

ft.app(main)

Expected behavior

No response

Screenshots / Videos

Captures [Upload media here]

Operating System

Windows

Operating system details

11

Flet version

0.24.1

Regression

No, it isn't

Suggestions

No response

Logs

Logs ```console [Paste your logs here] ```

Additional details

No response