CHAPTER 9: PYTHON – LOOPING AND TKINTER GUI
CHAPTER 9:
PYTHON – LOOPING AND TKINTER GUI
When we use else with while loop this structure is known as while-else loop. Using this loop, we can run an instruction code when the comparing value reaches to exceed limit of condition value.
When we use else with for loop, this structure is known as for-else loop. The else clause of a loop gets executed only if the loop completes its execution normally without having encountered with break statement.
Radiobutton is used to create one option out of many selections. The user is provided with multiple choices out of which only one can be selected.
Checkbutton is used to create multi-selection check boxes. User can select one or multiple check boxes from the list.
Loop causes a section of our program to be repeated a certain number of times. Using the loop, the lines of code reduce. It takes less time to type the code which saves overall time and also makes the program error-free.
Range is a pre-defined function of Python. This function is used when we need to perform an action for a specific number of times.
The three types of layout management methods of Tkinter are Pack, Grid and Place.
The for loop is used to repeat a block of statements until there are no item in any sequence. This statement iterates over the items of any sequence, in the order that they appear in the sequence.
Suppose our teacher asks us to read five pages from a book. Here the reading task is repetitive. So here we set this condition in loop, read the book until we reach up to the 5th page. The process of reading would stop when we reach page number 6.
Break statement can be used to unconditionally jump out of the loop. It terminates the execution of the loop. We can use it in while loop and for loop.
Continue statement is used to tell the program to skip the rest of the statements of the current iteration of loop block and move to next iteration of the loop. Loop does not terminate but continues on with the next iteration.
Widget is a small part of Graphical User Interface which provides better
controls for user. A user interacts with GUI using various controls like Label,
Entry, Button, Radio Button, etc.