-
Notifications
You must be signed in to change notification settings - Fork 446
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8635793
commit c1dc6cc
Showing
6 changed files
with
96 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import time | ||
|
||
import flet | ||
from flet import Container, ElevatedButton, Text | ||
|
||
|
||
def main(page): | ||
|
||
c = Container(content=Text("A")) | ||
|
||
def btn_click(e): | ||
c.content = Text(str(time.time())) | ||
page.update() | ||
|
||
page.add(c, ElevatedButton("Replace!", on_click=btn_click)) | ||
|
||
|
||
flet.app(name="test1", port=8550, target=main, view=flet.WEB_BROWSER) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import logging | ||
|
||
import flet | ||
from flet import ElevatedButton, SnackBar, Text | ||
|
||
logging.basicConfig(level=logging.DEBUG) | ||
|
||
|
||
class Data: | ||
def __init__(self) -> None: | ||
self.counter = 0 | ||
|
||
|
||
d = Data() | ||
|
||
|
||
def main(page): | ||
|
||
page.snack_bar = SnackBar( | ||
content=Text("Hello, world!"), | ||
# remove_current_snackbar=True, | ||
action="Alright!", | ||
) | ||
|
||
def on_click(e): | ||
# page.snack_bar.content.value = f"Hello, world: {d.counter}" | ||
page.snack_bar = SnackBar(Text(f"Hello {d.counter}")) | ||
page.snack_bar.open = True | ||
d.counter += 1 | ||
page.update() | ||
|
||
page.add(ElevatedButton("Open SnackBar", on_click=on_click)) | ||
|
||
|
||
flet.app(name="test1", port=8550, target=main, view=flet.WEB_BROWSER) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters