Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: 'hide' is not a valid WindowEventType #3505

Closed
1 task done
3mora2 opened this issue Jun 20, 2024 · 2 comments · Fixed by #3507
Closed
1 task done

ValueError: 'hide' is not a valid WindowEventType #3505

3mora2 opened this issue Jun 20, 2024 · 2 comments · Fixed by #3507
Assignees
Labels
bug Something isn't working

Comments

@3mora2
Copy link

3mora2 commented Jun 20, 2024

Duplicate Check

Describe the bug

            self.page.window.visible = False
            self.page.update()
asyncio:ERROR:Task exception was never retrieved
future: <Task finished name='Task-53' coro=<__run_socket_server.<locals>.on_event() done, defined at E:\Projects\temp project\AListerFlet\venv_pyins\Lib\site-packages\flet_runtime\app.py:217> exception=ValueError("'hide' is not a valid WindowEventType")>
Traceback (most recent call last):
  File "E:\Projects\temp project\AListerFlet\venv_pyins\Lib\site-packages\flet_runtime\app.py", line 219, in on_event
    await conn.sessions[e.sessionID].on_event_async(
  File "E:\Projects\temp project\AListerFlet\venv_pyins\Lib\site-packages\flet_core\page.py", line 914, in on_event_async
    await handler(ce)
  File "E:\Projects\temp project\AListerFlet\venv_pyins\Lib\site-packages\flet_core\event_handler.py", line 18, in fn
    ce = self.__result_converter(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Projects\temp project\AListerFlet\venv_pyins\Lib\site-packages\flet_core\page.py", line 157, in <lambda>
    self.__on_event = EventHandler(lambda e: WindowEvent(e))
                                             ^^^^^^^^^^^^^^
  File "E:\Projects\temp project\AListerFlet\venv_pyins\Lib\site-packages\flet_core\page.py", line 3074, in __init__
    self.type = WindowEventType(e.data)
                ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ammar\AppData\Local\Programs\Python\Python311\Lib\enum.py", line 714, in __call__
    return cls.__new__(cls, value)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ammar\AppData\Local\Programs\Python\Python311\Lib\enum.py", line 1130, in __new__
    raise ve_exc
ValueError: 'hide' is not a valid WindowEventType

Code

            self.page.window.visible = False
            self.page.update()

To reproduce

add 'hide' to WindowEventType in flet_core\types.py

Expected behavior

No response

Screenshots

No response

Operating System

Windows

Operating system details

win64

Flet version

v0.23.1

Regression

I'm not sure / I don't know

Suggestions

No response

Additional details

No response

@3mora2
Copy link
Author

3mora2 commented Jun 20, 2024

ValueError: 'show' is not a valid WindowEventType

@ndonkoHenri ndonkoHenri added the bug Something isn't working label Jun 20, 2024
@ndonkoHenri ndonkoHenri self-assigned this Jun 20, 2024
@ndonkoHenri ndonkoHenri linked a pull request Jun 21, 2024 that will close this issue
@ndonkoHenri ndonkoHenri moved this from 🆕 New to ✅ Done in Flet Development Jun 21, 2024
@ndonkoHenri ndonkoHenri moved this from ✅ Done to 👀 In review in Flet Development Jun 21, 2024
@feb-cloud
Copy link

feb-cloud commented Jun 21, 2024

+1
Flet==0.23.1
I have the same problem.

@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in Flet Development Jun 24, 2024
zrr1999 pushed a commit to zrr1999/flet that referenced this issue Jul 17, 2024
* Fix flet-dev#3503: `Slider.value` defaults to `min`

* Fix flet-dev#3505: add "hide" and "show" to  WindowEventType enum

* Fix flet-dev#3499: TypeError raised for isinstance check with Union in before_update method

- Corrected isinstance check in SnackBar.before_update to use a tuple of types instead of Union, resolving TypeError: "Subscripted generics cannot be used with class and instance checks".

* Fix `Page.open()` breaking after multiple calls

* Fix flet-dev#3516: delete Page.window.on_resize | deprecate Page.on_resize in favor of Page.on_resized

* Page: Typo in on_resized setter decorator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants