Skip to content

Doesn't copy text to clipboard on phone #3684

Closed Answered by Legolaz7
Legolaz7 asked this question in Q&A
Discussion options

You must be logged in to vote

I did it like this and it worked

from flet import *

def main(page: Page):
    page.title = "Test"
    page.window.width = 450.00
    page.window.height = 800.00
    page.window.resizable = True

    def copy(e):
        page.set_clipboard("Copy me")
        page.open(
            SnackBar(
                Text("Text copied!"),
                open=True
            )
        )
        page.update()

    x = AppBar(
        title=Text("Home page"),
        center_title=True
    )
    text = Text(value='Copy me', selectable=True)
    but = IconButton(icon=icons.CONTENT_COPY, on_click=copy)

    page.add(x, text, but)

app(target=main)

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@Legolaz7
Comment options

@ndonkoHenri
Comment options

@Legolaz7
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by ndonkoHenri
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants