@@ -9,7 +9,6 @@ This is how our example from the previous page looks inside a GUI:
99 :width: 15cm
1010
1111
12-
1312Defining structured data (objects)
1413=======================================
1514
@@ -45,7 +44,22 @@ load them from a JSON file back into the GUI.
4544 For verification purposes, the JSON file contains the full path to the defining class.
4645 Changing the class path requires users to update the corresponding path within the JSON files as well.
4746
48- Going down further we can see multiple rows, each one of the corresponding to a parameter.
47+ Below the "Template" button, an entry labeled "Object nickname" is located.
48+ This entry can be used to give an object a nickname.
49+ The nickname will be displayed before the class's name,
50+ allowing the object to be easily recognized at a glance.
51+
52+ .. image :: ./images/new_define_frame_struct_nickname.png
53+ :width: 15cm
54+
55+ This is how the object will look inside a Combobox, if it is given the name "David's car"
56+ (notice the parentheses at the beginning):
57+
58+ .. image :: ./images/example_gui_view_defined_nickname_car.png
59+ :width: 15cm
60+
61+
62+ Going down further we can see multiple rows, each one of them corresponding to a parameter.
4963
5064.. image :: ./images/new_define_frame_struct_parameters.png
5165 :width: 15cm
@@ -56,7 +70,32 @@ The next item on the right is a Combobox (:class:`~tkclasswiz.storage.ComboBoxOb
5670which is a dropdown menu used for storing the value of each defined parameter.
5771This dropdown menu can contain multiple values while we are still editing,
5872which we can access through the down arrow-like symbol located on the rightmost side of the Combobox.
59- When the definition frame is closed all the other values that were not selected inside the Combobox get discarded.
73+ When the definition frame is closed, all the other (not selected) values get discarded.
74+
75+
76+ .. note ::
77+
78+ While the dropdown menu (Combobox) can contains values manually defined through the GUI,
79+ it will sometimes have some predefined values. These values can be:
80+
81+ - None: Parameter was annotated with :class: `typing.Optional ` (``Optional[<type>] ``) or
82+ with :class: `typing.Union ` (``Union[None, ...] ``)
83+ - ``True `` and ``False ``: Parameter is a boolean parameter
84+ - Literal string values: Parameter is a literal string, meaning it is annotated with
85+ :class: `typing.Literal `. E. g, ``Literal['value1', 'value2', ...] `` annotation will produce the values 'value1' and
86+ 'value2' inside the Combobox.
87+
88+
89+ .. code-block :: python
90+
91+ class Person :
92+ def __init__ (self , name : str , job_type : Literal[" Science" , " Technology" , " Engineering" , " Math" ]):
93+ ...
94+
95+ .. image :: ./images/new_define_frame_struct_literal_values.png
96+ :width: 15cm
97+
98+
6099The dropdown menu is followed by 3 buttons:
61100
62101- "New": is a dropdown menu button, which allows to define multiple data types that the parameter accepts. It can
0 commit comments