from DemoFramework import DemoFramework from LUICheckbox import LUICheckbox import random f = DemoFramework() f.prepare_demo("LUICheckbox") # Constructor f.add_constructor_parameter("checked", "False") f.add_constructor_parameter("label", "'Checkbox'") # Functions f.add_public_function("get_checked", [], "bool") f.add_public_function("toggle_checked", [], "bool") f.add_public_function("set_checked", [("checked", "bool")]) f.add_public_function("get_label", [], "UILabel") f.add_property("checked", "bool") f.add_property("label", "LUILabel") # Events f.add_event("changed") f.construct_sourcecode("LUICheckbox") # Create the checkbox checkbox = LUICheckbox(parent=f.get_widget_node()) f.set_actions({ "Set Checked": lambda: checkbox.set_checked(True),
from DemoFramework import DemoFramework from LUILabel import LUILabel import random f = DemoFramework() f.prepare_demo("LUILabel") # Constructor f.add_constructor_parameter("text", "u'Label'") f.add_constructor_parameter("shadow", "True") f.add_constructor_parameter("font_size", "14") f.add_constructor_parameter("font", "'label'") # Functions f.add_public_function("get_text", [], "string") f.add_public_function("set_text", [("text", "string")]) # Events f.construct_sourcecode("LUILabel") # Create a new label label = LUILabel(parent=f.get_widget_node(), text="This is a fancy label") f.set_actions({ "Set Random Text": lambda: label.set_text(unicode(random.randint(100, 10000))), })
from DemoFramework import DemoFramework from LUIFormattedLabel import LUIFormattedLabel import random f = DemoFramework() f.prepare_demo("LUIFormattedLabel") # Functions f.add_public_function("clear", [], "void") f.add_public_function("newline", [], "void") f.add_public_function("add", [("*args", "List"), ("**kwargs", "Dict")]) # Events f.construct_sourcecode("LUIFormattedLabel") # Create a new label label = LUIFormattedLabel(parent=f.get_widget_node()) # Add parts to the label label.add(text="Hello ", color=(0.2,0.6,1.0)) label.add(text="World", color=(1.0,0.6,0.2)) label.add(text="! ") label.add(text="This ", font_size=20, margin=(-6, 0, 0, 0), color=(0.4,0.2,1.0)) label.add(text="is ", color=(1.0,0.2,1.0)) label.add(text="a formatted ", font_size=10, color=(0.6,0.3,0.6)) label.add(text="Label", font_size=25, margin =(-11, 0, 0, 0), color=(0.2,1.0,0.6)) # Go to next line
from DemoFramework import DemoFramework from LUIProgressbar import LUIProgressbar from LUISlider import LUISlider from LUILabel import LUILabel from panda3d.lui import LUIVerticalLayout import random f = DemoFramework() f.prepare_demo("LUIProgressbar") # Constructor f.add_constructor_parameter("show_label", "False") # Functions f.add_public_function("get_value", [], "float") f.add_public_function("set_value", [("value", "float")]) f.add_property("value", "float") # Events f.construct_sourcecode("LUIProgressbar") # Create the checkbox layout = LUIVerticalLayout(parent=f.get_widget_node(), spacing=10) LUILabel(parent=layout.cell(), text="This is a progressbar:", color=(1, 1, 1, 0.4)) bar = LUIProgressbar(parent=layout.cell(), width=200.0)
from DemoFramework import DemoFramework from LUIFormattedLabel import LUIFormattedLabel import random f = DemoFramework() f.prepare_demo("LUIFormattedLabel") # Functions f.add_public_function("clear", [], "void") f.add_public_function("newline", [], "void") f.add_public_function("add", [("*args", "List"), ("**kwargs", "Dict")]) # Events f.construct_sourcecode("LUIFormattedLabel") # Create a new label label = LUIFormattedLabel(parent=f.get_widget_node()) # Add parts to the label label.add(text="Hello ", color=(0.2, 0.6, 1.0)) label.add(text="World", color=(1.0, 0.6, 0.2)) label.add(text="! ") label.add(text="This ", font_size=20, margin=(-6, 0, 0, 0), color=(0.4, 0.2, 1.0)) label.add(text="is ", color=(1.0, 0.2, 1.0)) label.add(text="a formatted ", font_size=10, color=(0.6, 0.3, 0.6)) label.add(text="Label", font_size=25,
from DemoFramework import DemoFramework from LUIRadiobox import LUIRadiobox from LUIRadioboxGroup import LUIRadioboxGroup from LUIVerticalLayout import LUIVerticalLayout import random f = DemoFramework() f.prepare_demo("LUIRadiobox") # Constructor f.add_constructor_parameter("group", "None") f.add_constructor_parameter("value", "None") f.add_constructor_parameter("label", "'Radiobox'") # Functions f.add_public_function("get_value", [], "object") f.add_public_function("get_label", [], "LUILabel") f.add_public_function("set_active", [], "void") f.add_property("value", "object") f.add_property("label", "LUILabel") # Events f.add_event("changed") f.construct_sourcecode("LUIRadiobox") # Create a group to connect the boxes group = LUIRadioboxGroup()
from DemoFramework import DemoFramework from LUIButton import LUIButton import random f = DemoFramework() f.prepare_demo("LUIButton") # Constructor f.add_constructor_parameter("text", "u'Button'") f.add_constructor_parameter("template", "'ButtonDefault'") # Functions f.add_public_function("set_text", [("text", "string")]) # Events f.construct_sourcecode("LUIButton") # Create 2 new buttons button1 = LUIButton(parent=f.get_widget_node(), text="Do not click me") button2 = LUIButton(parent=f.get_widget_node(), text="Instead click me", template="ButtonMagic", left=button1.width + 10) # f.set_actions({ # "Set Random Text": lambda: label.set_text(unicode(random.randint(100, 10000))), # })
from DemoFramework import DemoFramework from LUIVerticalLayout import LUIVerticalLayout from LUIFrame import LUIFrame from LUILabel import LUILabel from LUIButton import LUIButton from LUIObject import LUIObject import random f = DemoFramework() f.prepare_demo("LUIFrame") # Constructor f.add_constructor_parameter("width", "200") f.add_constructor_parameter("height", "200") f.add_constructor_parameter("innerPadding", "5") f.add_constructor_parameter("scrollable", "False") f.add_constructor_parameter("style", "UIFrame.Raised") # Functions # Events f.construct_sourcecode("LUIFrame") # Construct a new frame frame = LUIFrame(parent=f.get_widget_node()) layout = LUIVerticalLayout(parent=frame, spacing=5) layout.add(LUILabel(text="This is some frame ..", color=(0.2, 0.6, 1.0, 1.0), font_size=20))
from DemoFramework import DemoFramework from LUIButton import LUIButton from LUIHorizontalLayout import LUIHorizontalLayout import random f = DemoFramework() f.prepare_demo("LUIButton") # Constructor f.add_constructor_parameter("text", "u'Button'") f.add_constructor_parameter("template", "'ButtonDefault'") # Functions f.add_public_function("set_text", [("text", "string")]) f.add_public_function("get_text", [], "string") f.add_property("text", "string") # Construct source code f.construct_sourcecode("LUIButton") # Create 2 new buttons, and store them in a vertical layout layout = LUIHorizontalLayout(parent=f.get_widget_node(), spacing=10) button1 = LUIButton(text="Do not click me") button2 = LUIButton(text="Instead click me", template="ButtonGreen") layout.add(button1) layout.add(button2)
from DemoFramework import DemoFramework from LUIProgressbar import LUIProgressbar from LUISlider import LUISlider from LUILabel import LUILabel from LUIVerticalLayout import LUIVerticalLayout import random f = DemoFramework() f.prepare_demo("LUIProgressbar") # Constructor f.add_constructor_parameter("show_label", "False") # Functions f.add_public_function("get_value", [], "float") f.add_public_function("set_value", [("value", "float")]) f.add_property("value", "float") # Events f.construct_sourcecode("LUIProgressbar") # Create the checkbox layout = LUIVerticalLayout(parent=f.get_widget_node(), spacing=10) LUILabel(parent=layout.cell(), text="This is a progressbar:", color=(1, 1, 1, 0.4)) bar = LUIProgressbar(parent=layout.cell(), width=200.0)
from DemoFramework import DemoFramework from LUIFrame import LUIFrame import random f = DemoFramework() f.prepare_demo("LUIFrame") # Constructor f.add_constructor_parameter("width", "200") f.add_constructor_parameter("height", "200") f.add_constructor_parameter("innerPadding", "5") f.add_constructor_parameter("scrollable", "False") f.add_constructor_parameter("style", "UIFrame.Raised") # Functions # Events # f.add_event("changed") f.construct_sourcecode("LUIFrame") frame = LUIFrame(width=300, height=100, parent=f.get_widget_node()) f.set_actions({ "Resize to 100x100": lambda: frame.set_size(100, 100), "Resize to 150x150": lambda: frame.set_size(150, 150), "Fit to children": lambda: frame.fit_to_children(), "Resize to Random Size": lambda: frame.set_size(random.randint(10, 150), random.randint(10, 150)), })
from DemoFramework import DemoFramework from LUIFormattedLabel import LUIFormattedLabel import random f = DemoFramework() f.prepare_demo("LUIFormattedLabel") # Constructor # Functions f.add_public_function("clear", [], "void") f.add_public_function("br", [], "void") f.add_public_function("add_text", [("*args", "List"), ("**kwargs", "Dict")]) # Events f.construct_sourcecode("LUIFormattedLabel") # Create a new label label = LUIFormattedLabel(parent=f.get_widget_node()) # Add parts to the label label.add_text(text="Hello ", color=(0.2,0.6,1.0)) label.add_text(text="World", color=(1.0,0.6,0.2)) label.add_text(text="! ") label.add_text(text="This ", font_size=20, margin_top=-6, color=(0.4,0.2,1.0)) label.add_text(text="is ", color=(1.0,0.2,1.0)) label.add_text(text="a formatted ", font_size=10, color=(0.6,0.3,0.6))
from DemoFramework import DemoFramework from LUIInputField import LUIInputField import random f = DemoFramework() f.prepare_demo("LUIInputField") # Constructor f.add_constructor_parameter("value", "u''") f.add_constructor_parameter("placeholder", "u'Enter some text ..'") f.add_property("value", "string") f.add_event("changed") # Construct source code f.construct_sourcecode("LUIInputField") # Create 2 new buttons, and store them in a vertical layout field = LUIInputField(parent=f.get_widget_node()) f.set_actions({ "Set Random Text": lambda: field.set_value(u"Text: " + unicode(random.randint(100, 10000000))), "Clear": lambda: field.clear(), }) run()
from DemoFramework import DemoFramework from LUILabel import LUILabel from LUIBlockText import LUIBlockText from LUIScrollableRegion import LUIScrollableRegion import random f = DemoFramework() f.prepare_demo("LUIBlockText") # Constructor f.add_constructor_parameter("text", "u'Label'") f.add_constructor_parameter("shadow", "True") f.add_constructor_parameter("font_size", "14") f.add_constructor_parameter("font", "'label'") # Functions f.add_public_function("clear", []) f.add_public_function("set_text", [("text", "string")]) f.add_public_function("set_wrap", [("wrap", "boolean")]) f.add_public_function("set_width", [("width", "integer")]) f.add_property("labels", "list") # Events f.construct_sourcecode("LUIBlockText") text_container = LUIScrollableRegion( parent=f.get_widget_node(), width=340,
from DemoFramework import DemoFramework from LUICheckbox import LUICheckbox import random f = DemoFramework() f.prepare_demo("LUICheckbox") # Constructor f.add_constructor_parameter("checked", "False") f.add_constructor_parameter("label", "'Checkbox'") # Functions f.add_public_function("get_checked", [], "bool") f.add_public_function("toggle_checked", [], "bool") f.add_public_function("set_checked", [("checked", "bool")]) f.add_public_function("get_label", [], "UILabel") # Events f.add_event("changed") f.construct_sourcecode("LUICheckbox") # Create the checkbox checkbox = LUICheckbox(parent=f.get_widget_node()) f.set_actions({ "Set Checked": lambda: checkbox.set_checked(True), "Set Unchecked": lambda: checkbox.set_checked(False), "Toggle Checked": lambda: checkbox.toggle_checked(),
from DemoFramework import DemoFramework from LUISlider import LUISlider from LUILabel import LUILabel from LUIVerticalLayout import LUIVerticalLayout import random f = DemoFramework() f.prepare_demo("LUISlider") # Constructor f.add_constructor_parameter("filled", "False") f.add_constructor_parameter("min_value", "0.0") f.add_constructor_parameter("max_value", "0.0") f.add_constructor_parameter("value", "None") # Functions f.add_public_function("get_value", [], "float") f.add_public_function("set_value", [("value", "float")]) f.add_property("value", "float") # Events f.add_event("changed") f.construct_sourcecode("LUISlider") # Create the checkbox layout = LUIVerticalLayout(parent=f.get_widget_node(), spacing=10)
from DemoFramework import DemoFramework from LUILabel import LUILabel import random f = DemoFramework() f.prepare_demo("LUILabel") # Constructor f.add_constructor_parameter("text", "Label") f.add_constructor_parameter("shadow", "True") f.add_constructor_parameter("font_size", "14") f.add_constructor_parameter("font", "'label'") # Functions f.add_public_function("get_text", [], "string") f.add_public_function("set_text", [("text", "string")]) f.add_property("text", "string") f.add_property("text_handle", "LUIText") # Events f.construct_sourcecode("LUILabel") # Create a new label label = LUILabel(parent=f.get_widget_node(), text="This is a fancy label") f.set_actions({ "Set Random Text": lambda: label.set_text(str(random.randint(100, 10000))),
from DemoFramework import DemoFramework from LUILabel import LUILabel from LUIBlockText import LUIBlockText from LUIScrollableRegion import LUIScrollableRegion import random f = DemoFramework() f.prepare_demo("LUIBlockText") # Constructor f.add_constructor_parameter("text", "u'Label'") f.add_constructor_parameter("shadow", "True") f.add_constructor_parameter("font_size", "14") f.add_constructor_parameter("font", "'label'") # Functions f.add_public_function("clear", []) f.add_public_function("set_text", [("text", "string")]) f.add_public_function("set_wrap", [("wrap", "boolean")]) f.add_public_function("set_width", [("width", "integer")]) f.add_property("labels", "list") # Events f.construct_sourcecode("LUIBlockText") text_container = LUIScrollableRegion(