Skip to content

Commit 45aad3b

Browse files
authored
Revised first steps in docs (#25)
* Revised forst steps in docs * Delete poetry.lock --------- Co-authored-by: @vjurcutiu Co-authored-by: @davidhozic
1 parent 57b50ec commit 45aad3b

File tree

1 file changed

+22
-24
lines changed

1 file changed

+22
-24
lines changed

docs/source/guide/firststeps.rst

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@ First steps
55

66
To define your first object parameters with TkClassWizard, you can create
77
a :class:`tkinter.TopLevel` inherited object :class:`~tkclasswiz.object_frame.window.ObjectEditWindow` and then
8-
call its :py:meth:`~tkclasswiz.object_frame.window.ObjectEditWindow.open_object_edit_frame` method, which
9-
will open up the window and then load in :class:`tkinter.Frame`, which will contain placeholders for all parameter
8+
call its :py:meth:`~tkclasswiz.object_frame.window.ObjectEditWindow.open_object_edit_frame` method. This
9+
will open up the window and then load :class:`tkinter.Frame`, which will contain placeholders for all the parameter
1010
values.
1111

1212
The :py:meth:`~tkclasswiz.object_frame.window.ObjectEditWindow.open_object_edit_frame` method accepts the following
1313
parameters:
1414

15-
- class\ _: This is the class or a function that we want the parameters for.
15+
- class\ _: This is the class or function that will accept our given parameters.
1616
- return_widget: This is a widget that receives the value after saving the newly defined parameters.
17-
- old_data: The old_data gui data.
18-
- check_parameters: Boolean parameter, which if True will not test if the object parameters are correct. When
17+
- old_data: The old_data GUI data.
18+
- check_parameters: Boolean parameter. If True, it will not test whether the object parameters are correct. When
1919
editing a function this is not ignored.
20-
- allow_save: Boolean parameter, which if False will prevent the defined data to be saved; This also means it will
20+
- allow_save: Boolean parameter. If False, it will not allow the defined data to be saved; This also means it will
2121
be read-only.
2222

2323

24-
It's best we take a look at an example.
24+
Let's take a look at an example.
2525

2626
.. code-block:: python
2727
:linenos:
@@ -72,40 +72,38 @@ It's best we take a look at an example.
7272
7373
7474
75-
In the above example we first import the library by typing ``import tkclasswiz as wiz``.
75+
In this example we first import the library by typing ``import tkclasswiz as wiz``.
7676
Then we define 2 classes, the class ``Wheel`` and class ``Car``.
7777

7878
The ``Wheel`` class accepts a single parameter annotated with the ``float`` type. It is VERY IMPORTANT
79-
that all the parameters are annotated, else they will not be displayed when defining parameters through the GUI.
79+
that all the parameters are annotated. Otherwise they will not be displayed when defining parameters through the GUI.
8080

81-
The ``Car`` class accepts parameters ``name`` of type ``str``, ``speed`` of type ``float`` and list of ``wheels``
82-
of type ``Wheel``. From the ``wheels`` parameter we can see that we can define multiple nested objects as well.
81+
The ``Car`` class accepts the following parameters: ``name`` of type ``str``, ``speed`` of type ``float`` and a list of ``wheels``
82+
of type ``Wheel``. The ``wheels`` parameter allows us to define multiple nested objects as well.
8383

8484
Then we create an instance of ``Tk``, which is just the standard way for creating a tkinter app.
8585

86-
Then we create a ``combo`` variable of type :class:`~tkclasswiz.storage.ComboBoxObjects`, which will receive the defined
87-
``Car`` object after we define the object successfully. But it won't receive an actual instance of ``Car``,
88-
however it will receive an abstract representation of the defined object. The abstract representation is an instance of
89-
:class:`tkclasswiz.convert.ObjectInfo` and its job is to store the class (in our case ``Car``) and the parameters
90-
defined. When displaying the defined abstract ``Car`` object inside the GUI, it will be displayed as
86+
After that, we create a ``combo`` variable of type :class:`~tkclasswiz.storage.ComboBoxObjects`, which will receive the
87+
``Car`` object after it is defined successfully. However, it won't receive an actual instance of ``Car``. Instead, it will receive an abstract representation of the defined object. The abstract representation is an instance of
88+
:class:`tkclasswiz.convert.ObjectInfo` and its job is to store the class (in our case ``Car``) and the defined parameters. When displaying the defined abstract ``Car`` object inside the GUI, it will be displayed as
9189
``Class(parameter1=value1, ...)``.
9290

93-
Afterwards we define 2 functions, the first one will open the definition window, while the second one will
91+
We then define 2 functions. The first one will open the definition window, while the second one will
9492
convert the abstract ``Car`` object into a real Python object.
9593

96-
Function ``make_car`` accepts a parameter ``old``, which will be later used to edit the existing object after we defined it.
97-
But since it is not defined yet, this is currently irrelevant. Next lines of code in the function create the
94+
The function ``make_car`` accepts a parameter ``old``, which will be used to edit the existing object after we defined it at a later point.
95+
However, since it is not currently defined, it has no effect. The next lines of code in the function create the
9896
:class:`~tkclasswiz.object_frame.window.ObjectEditWindow` definition window and load in the definition frame by calling
99-
the :py:meth:`~tkclasswiz.object_frame.window.ObjectEditWindow.open_object_edit_frame`, which we pass
100-
the class of an object we want to define (``Car``), the return widget (``combo``) that receives the defined object and
97+
the :py:meth:`~tkclasswiz.object_frame.window.ObjectEditWindow.open_object_edit_frame`. With this method, we can pass
98+
the class of an object we want to define (``Car``), the return widget (``combo``) that receives the defined object, and
10199
the ``old_data`` parameter which would load in previously defined values (which currently don't exist).
102100

103101
At the very bottom of the example, we define a few buttons:
104102

105-
- 'Define Car': Calls ``make_car`` function, opening the object definition window.
106-
- 'Edit Car': Calls ``make_car`` function, opening the object definition window and loading in the already defined
103+
- 'Define Car': Calls the ``make_car`` function, opening the object definition window.
104+
- 'Edit Car': Calls the ``make_car`` function, opening the object definition window and loading in the already defined
107105
:class:`tkclasswiz.convert.ObjectInfo` abstract ``Car`` object.
108-
- 'Print defined': Calls ``print_defined`` function which converts the abstract object into a real one and prints it out,
106+
- 'Print defined': Calls the ``print_defined`` function, which converts the abstract object into a real one and prints it out,
109107
including its type.
110108

111109
Now let's take a look at how our example looks :ref:`inside a GUI <Defining data>`.

0 commit comments

Comments
 (0)