Skip to content

Fix page.run_thread does not receive kwargs #5320

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

python-and-novella
Copy link

@python-and-novella python-and-novella commented May 19, 2025

Description

Fixes #5318

Test Code

import flet as ft
import asyncio
import time
from datetime import datetime

async def main(page: ft.Page):
    page.add(
        text := ft.Text(f'{datetime.now()}'),
        text2 := ft.Text(f'{datetime.now()}')
    )
    async def update_time(name=None,*,end=''):
        while True:
            text.value = f'{name} is {datetime.now()} {end}'
            text.update()
            await asyncio.sleep(1)
            
    page.run_task(update_time,'Time',end='.')
    
    def update_time_sync(name=None,*,end=''):
        while True:
            text2.value = f'{name} is {datetime.now()} {end}'
            text2.update()
            time.sleep(1)
            
    page.run_thread(update_time_sync,'Time',end='.')

    
ft.app(target=main)

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Summary by Sourcery

Bug Fixes:

  • Allow page.run_thread (and page.run_task) to receive keyword arguments by updating the internal wrapper to accept and forward **kwargs.

@CLAassistant
Copy link

CLAassistant commented May 19, 2025

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

page.run_thread does not receive kwargs
2 participants