namnguyen hace 7 meses
padre
commit
7fd06c93d3

+ 3 - 3
doc/gui/examples/controls/input_active.py

@@ -15,11 +15,11 @@
 # -----------------------------------------------------------------------------------------
 from taipy.gui import Gui
 
-init_value = 20
+value = 20
 
 page = """
-Input field has been disabled: <|{init_value}|input|active=false|>
+<|{value}|input|active=false|>
 """
 
 if __name__ == "__main__":
-    Gui(page).run()
+    Gui(page).run(title="Input - Inactive")

+ 7 - 5
doc/gui/examples/controls/input_change_delay_on_change.py

@@ -20,18 +20,20 @@ from taipy.gui import Gui
 # Configure logging
 logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
 
-INIT_VALUE = ""
+value = ""
 
 
-def on_change(state, var_name, value):
-    logging.info(f"Value of {var_name} changed to {value}")
+# The [on_change] property is not set: Taipy GUI automatically finds and binds the global on_change()
+# function to handle changes in the input control. You could set this property to your own function if necessary.
+def on_change(state, var_name, v):
+    logging.info(f"Value of {var_name} changed to {v}")
 
 
 # If change_delay is set to -1, the change event is triggered on Enter key press
 page = """
-Enter a number (changes triggered on Enter key press): <|{INIT_VALUE}|input|change_delay=-1|on_change=on_change|>
+<|{value}|input|change_delay=-1|>
 """
 
 
 if __name__ == "__main__":
-    Gui(page).run()
+    Gui(page).run(title="Input - on_change")

+ 3 - 3
doc/gui/examples/controls/input_line_shown.py

@@ -15,11 +15,11 @@
 # -----------------------------------------------------------------------------------------
 from taipy.gui import Gui
 
-numbered_lines = "1 \n2 \n3 \n4 \n5"
+lines = "1 \n2 \n3 \n4 \n5"
 
 page = """
-Multi-line input: <|{numbered_lines}|input|multiline|lines_shown=5|>
+<|{lines}|input|multiline|lines_shown=5|>
 """
 
 if __name__ == "__main__":
-    Gui(page).run()
+    Gui(page).run(title="Input - Lines shown")

+ 3 - 3
doc/gui/examples/controls/input_multiline.py

@@ -15,12 +15,12 @@
 # -----------------------------------------------------------------------------------------
 from taipy.gui import Gui
 
-LOREM_IPSUM = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nec purus et nunc lacinia gravida. " \
+text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nec purus et nunc lacinia gravida. " \
 
 
 page = """
-Multi-line input: <|{LOREM_IPSUM}|input|multiline|>
+<|{text}|input|multiline|>
 """
 
 if __name__ == "__main__":
-    Gui(page).run()
+    Gui(page).run(title="Input - Multiline")

+ 4 - 5
doc/gui/examples/controls/input_on_action.py

@@ -21,7 +21,7 @@ from taipy.gui import Gui
 logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
 
 
-def print_value_on_key_pressed(state, id, payload):
+def key_pressed(state, id, payload):
     key = payload.get('args', [None])[0]
     if key == 'F1':
         logging.info("F1 key pressed")
@@ -33,13 +33,12 @@ def print_value_on_key_pressed(state, id, payload):
         return None
 
 
-init_value = 0
+value = 0
 
 # on_action function is called when the action_keys are pressed
 page = """
-Enter a number (on_action triggered on F1, F2, F3 key press):
-<|{init_value}|input|change_delay=300|on_action=print_value_on_key_pressed|action_keys=F1;F2;F3|>
+<|{value}|input|change_delay=300|on_action=key_pressed|action_keys=F1;F2;F3|>
 """
 
 if __name__ == "__main__":
-    Gui(page).run()
+    Gui(page).run(title="Input - On change")

+ 2 - 2
doc/gui/examples/controls/input_password.py

@@ -16,8 +16,8 @@
 from taipy.gui import Gui
 
 page = """
-Input your password: <|input|password|>
+<|input|password|>
 """
 
 if __name__ == "__main__":
-    Gui(page).run()
+    Gui(page).run(title="Input - Password")

+ 2 - 2
doc/gui/examples/controls/input_type.py

@@ -18,8 +18,8 @@ from taipy.gui import Gui
 number = 0
 
 page = """
-Enter a number: <|{number}|input|type=number|>
+<|{number}|input|type=number|>
 """
 
 if __name__ == "__main__":
-    Gui(page).run()
+    Gui(page).run(title="Input - Type")