-
Notifications
You must be signed in to change notification settings - Fork 12
D `StoryBoard` class
When you make a target function for the LoadStoryBoard
class, you put on this target an arg with type StoryBoard
.
Like on this code:
from fletsb import LoadStoryBoard, StoryBoard
def main (st:StoryBoard): # Here you can see an arg with `StoryBoard` typed class
pass
LoadStoryBoard(main, "myUI.fletsb")
So lets start 🏃♀️.
Its a class where you can manage your StoryBoard
using this class.
What did I mean by manage ?
There are many functions that this StoryBoard
class contain, like:
add_function
function allow you to define a function to the StoryBoard. When you create a button widget and you set a on_click
function name, the StoryBoards need to know this function to call when ever you click the button.
For example:
from fletsb import LoadStoryBoard, StoryBoard
def main (st:StoryBoard):
st.add_function(function_name="my_print", function=print)
LoadStoryBoard(main, "myUI.fletsb")
get_point
function allow to get point where some data may be in. Like on TextField there is an option where you can make the Text of the Field be saved on a place called "point", you can rename this point on the editor then you can call it using StoryBoard
class and this function. For code example:
from fletsb import LoadStoryBoard, StoryBoard
def main (st:StoryBoard):
my_point = st.get_point(point_name="my_point")
LoadStoryBoard(main, "myUI.fletsb")
navigate_to_page
function allow you to navigate to a page by call the function and give it the page name you want. You can create new pages on the editor.
add_flet_control
function allow you to add external flet
control on the storyBoard. For code example:
from fletsb import LoadStoryBoard, StoryBoard
import flet
def main (st:StoryBoard):
st.add_flet_control(control=flet.Text("external text"))
LoadStoryBoard(main, "myUI.fletsb")