EXERCISES PREPARED IN RELATION TO THE TKINTER COURSE BY JOHN PHILIP JONES ON YOUTUBE
No exercises proposed for the introductory videos 1 and 2.
Video3. Tkinter objects.
3.1. What is an object? Provide examples.
3.2. Is the window created by Tkinter an object?
3.3. Provide two examples of an attribute within the window created with Tkinter.
3.4. What is a method? Provide examples.
3.5. Is the tk() a class?
3.6. What two basic things do a tk() class have?
3.7. What is the difference between attributes and methods?
3.8. Is a variable an instance of an attribute or a method?
Video4. Tkinter events and mainloop().
4.1. Provide two examples of an event.
4.2. Provide two examples of a widget.
4.3. In the instance root=tk(), is root a variable?
4.4. In root.mainloop(), is mainloop() a method?
4.5. In root.mainloop(), what does mainloop() do, what is it for?
4.6. In from tkinter import *, what does the * mean?
Video5. How to set the background colour of a Python Tkinter window.
5.1. Reproduce and example of the three lines needed to setup and run a Tkinter GUI window.
5.2. Between which two lines is the code placed?
5.3. Write three different Tkinter scripts, each for a window of different colour.
5.4. What colour is represented by the first two digits, in a hexadecimal colour notation?
5.5. What colour is represented by the second two digits, in a hexadecimal colour notation?
5.6. What colour is represented by the last two digits, in a hexadecimal colour notation?
5.7. Find out what base use the hexadecimal numerals.
5.8. Hexadecimal numerals use numbers 0 to 9 and what letters?
5.9. Using Python code, find how many different colours can be defined by the hexadecimal system.
Video6. Setting the size of a Tkinter window.
6.1. Setup a title, size, and background colour of a Tkinter GUI window.
Video7. How to set the location of a Python Tkinter window.
7.1. Setup the size of a Tkinter GUI window using geometry, and configure.
7.2. Where is the geometry position ‘0x0’?
Video8. Creating a fixed size Python Tkinter window.
8.1. Create a window of proportions 4:3, i.e. 4 pixels width for each 3 pixels height.
8.2. Make the previous window fixed in height.
8.3. Make the previous window fixed size.
Video9. How to place the Python Tkinter window in the centre of the screen.
9.1. Create a window with title ‘Tina’, orange colour, and proportion 16:9.
9.2. Place the window at the left top corner of the monitor.
9.3. Place the window halfway between the left top and bottom corner of the monitor.
9.4. Place the window halfway between the left and right top corner of the monitor.
9.5. Place the window at the centre of the monitor.
9.6. Place the window coinciding its left bottom corner with the one of the monitor.
9.7. Place the window coinciding its right bottom corner with the one of the monitor.
Video10. Introduction to the Tkinter Label widget.
10.1. Create a window and set the background colour to white.
10.2. Place the window at the top of the monitor and halfway between the left and right sides.
10.3. Introduce three labels with messages of different sizes, and pack them in any given order.
10.4. Pack the second label first, the first one last, and the third label in the middle.
Video11. Setting the font type, font colour, and font size of a label.
11.1. Create a window of proportion 9:4, and set the background colour to ‘peach puff’.
11.2. Create a green text on black background label with and italic Verdana font of size 24.
11.3. Add a yellow text on gray30 background label with a bold Arial font of size 20.
11.4. Find the fonts supported, and add a third label of your design.
Video12. Setting the width of a Tkinter label.
12.1. What units does Tkinter use to express the size of a label?
12.2. Create a squared window, and place it in the middle of the monitor.
12.3. Add two labels with different texts, colours, fonts, and sizes.
Video13. Displaying multiple lines of text in a Python Tkinter label.
13.1. Add multiple lines to the labels of the previous exercise.
Video14. Setting the look of the border of a Python Tkinter label.
14.1. Add different borderwidth options to the labels of the previous exercise.
14.2. Show in a single window the six different borderwidth relief options available.
Video15. Setting the height of a Python Tkinter label.
15.1. Add the height option to the labels of the previous exercises.
Video16. Positioning text within a Python Tkinter label.
16.1. Where would a text be positioned within a label if an anchor is not specified?
16.2. Modify the previous exercises positioning the text of the label in five different positions.
Video17. How to pad space around the text of a Python Tkinter label.
17.1. Create three labels with different horizontal and vertical padding.
Video18. How to justify text in a Python Tkinter label.
18.1. Create three labels with different justifications.
Video19. How to justify text in a Python Tkinter label.
19.1. Add different anchoring and padding options to the previous exercise.
Video20. How to justify text in a Python Tkinter label.
20.1. Print the values for the different options (keys) of the previous exercise.
Video21. Dynamically altering a Python Tkinter label.
21.1. Dynamically change the values for the different options of the previous exercise.
Video22. The Python Tkinter keys( ) method for a label.
22.1. Print all the possible options (keys) of a label (or some other widget).
22.2. Print the values of all the options (keys) of a label (or some other widget) from a previous exercise.
22.3. Repeat exercise 20.1 and compare it with the previous exercise.
Video23. Using StringVar and textvariable with a Python Tkinter label.
23.1. Use StringVar (set method) to assign a text to a label.
23.2. Use StringVar to assign the result of the area of a 4 by 4 square to a label.
23.3. Show the value of the area of a circle of radius 2 (Pi = 3.14, or e.g. the SymPy module can be used).
Video 24. The Python Tkinter StringVar set( ) method.
24.1. Use StringVar (set method) to display the value of a square of side 10, and keys to display the area of circle of radius 5, in two different labels.
Video 25. Introduction to the Python Tkinter button widget.
25.1. Create a button with similar attributes to the labels in previous exercises.
25.2. When clicking a button, display the result from exercise 23.3.
25.3. Recalling exercise 21.1, display the area of a circle of radius + 1 each time a button is clicked.
25.4. When clicking a button, display a consecutive Fibonacci number, starting at one. This video may be of assistance.
Video 26. The Tkinter grid geometry manager.
26.1. Select a number of previous exercises, and apply grid geometry, instead of pack.
26.2. Improve the design taking advantage of new options, as in this video, for example.
Video 27. Designing a simple Tkinter GUI.
27.1. Design a calculator for the area of a circle, with buttons 0 to 9, dot, clear, and equal sign.
Video 28. The Tkinter Entry widget.
28.1. Design a calculator with an execution button, where input is entered from the keyboard.
28.2. Adapt 27.1 where input can be entered from buttons or from the keyboard.
Video 29. The Entry widget and StringVar( ).
29.1. Adapt 28.1 using StringVar( ).
29.2. Adapt 28.2 using StringVar( ).
29.3. Using SymPy or similar module, adapt 28.1 to solve equations.
Video 30. Fahrenheit to Celsius Python GUI.
30.1. Design a GUI to convert miles to kilometres.
Video 31. Alternative Python Fahrenheit to Celsius GUI.
31.1. Using the StringVar( ) and .set alternative, design a GUI to convert kilograms to stones.
Video 32. Setting the focus within a Python GUI.
32.1. Add focus to some of the previous exercises.
Video 33. Focus and tab order of widgets in a Python GUI.
33.1. Set different focus order in some of the previous exercises.
Video 34. Introduction to the Python Tkinter frame widget.
34.1. Prepare the graphical design of frames for some of the previous exercises.
34.2. Prepare the graphical design of frames for a scientific calculator.
Video 35. Building a Python Tkinter GUI using frames.
35.1. Apply frames to some of the previous exercises.
35.2. Apply a frames to the standard (non-scientific) part of 34.2.
Video 36. Adding frames to a Python Tkinter window.
36.1. Apply multiple frames to some of the previous exercises.
36.2. Apply multiple frames to exercise 35.2.
Video 37. How to inherit from a Python Tkinter frame. [Classes]
37.1. Apply a Super Class (Parent) and Sub-Classes (Children) to exercise 36.2.
Video 38. The id and type of a widget that inherits from a Python Tkinter frame.
38.1. Find the id and type of different objects from the previous exercise.
Video 39. The need for the __init__ method and self parameter when inheriting with Tkinter.
39.1. Apply instances of a Class to exercise 34.2, showing the ids of both instances.
39.2. Identify the Super Class and the Sub-Classes in the previous exercise.
Video 40. Using the Python help function to assist with inheritance.
40.1. Examine and understand the help information for the Class from exercise 39.1.
Video 41. Using inheritance to build a Python Tkinter GUI.
41.1. Organize exercise 34.2 with Sub-Classes.
Video 42. Full screen window using Tkinter.
42.1. Add a full screen window instruction to the previous exercise.
Video 43. Full screen Tkinter window using the f string.
43.1. Repeat the previous exercise using a f string format.