SRM INSTITUTE OF SCIENCE AND TECHNOLOGY FACULTY OF ENGINEERING AND TECHNOLOGY
SCHOOL OF COMPUTING
DEPARTMENT OF COMPUTATIONAL INTELLIGENCE
21CSC203P ADVANCED PROGRAMMING PRACTICE
Week 11 – GUI -Event Programming Paradigm(Tkinter) & Symbolic Programming Paradigm
1. Place Method:
1. Create a window and place a label, button, and entry widget using absolute positioning. Adjust
their positions and dimensions to your liking.
2. Place multiple labels and buttons in a grid-like arrangement using the place method. Experiment
with different coordinates and dimensions to create a more complex layout.
3. Place a label with an image using the place method. Adjust the image's position and size to fit
within the label.
Fill:
Add a label, an entry, and a button to the window.
Experiment with different fill values for each widget (e.g., fill=tk.X, fill=tk.Y, fill=tk.BOTH) and
observe how their sizes change when the window is resized.
Expand:
Set the expand parameter to True for one or more widgets.
Side:
Resize the window and see how these widgets expand to fill the available space.
Place widgets on different sides of the window (e.g., side=tk.TOP, side=tk.BOTTOM, side=tk.LEFT,
side=tk.RIGHT). Observe how their positions change relative to each other.
2.Grid Method:
1. Create a window and place a label, button, and entry widget using the grid method. Specify their
row and column indices to arrange them in a grid-like layout.
2. Create a grid of labels using the grid method. Experiment with different row and column spans
to create varying grid cell sizes.
3. Place a label with an image using the grid method. Adjust the image's row and column indices
and spans to fit within the grid cell.
3.Pack Method:
1. Create a window and place a label, button, and entry widget using the pack method. Experiment
with different pack options (side, fill, expand) to observe how they affect the widget's
placement.
2. Place multiple labels and buttons in a vertical or horizontal stack using the pack method. Adjust
the pack options to control the direction and spacing.
3. Place a label with an image using the pack method. Adjust the pack options to control the
image's size and alignment within the label.
4. Label:
1. Create a label with the text "Hello, World!"
2. Change the font, color, and size of the label.
3. Position the label in different parts of the window.
5.Button:
1. Create a button that prints "Button clicked" when pressed.
2. Change the text, color, and font of the button.
3. Position the button in different parts of the window.
Create a flat button:
• Create a flat button using the Button widget with the relief attribute set to "flat".
Create a sunken button:
• Create a button and set the relief attribute to "sunken".
Create a grooved button:
• Create a button but set the relief attribute to "groove".
6.Textbox:
1. Create a textbox where users can enter text.
2. Get the text entered by the user.
3. Set the initial text in the textbox.
7.Entry Method:
1. Create an entry field where users can enter a number.
2. Validate the input to ensure it's a valid number.
3. Perform calculations or actions based on the entered value.
8. Create a frame:
1. Import the tkinter module.
2. Create a Tkinter window.
3. Create a frame using the Frame widget.
4. Pack or grid the frame into the window.
Change frame attributes:
1. Modify the bg attribute to change the background color.
2. Use the width and height attributes to control the frame's dimensions.
3. Set the relief attribute to create a raised, sunken, or grooved effect.
Place widgets within a frame:
1. Create widgets (e.g., buttons, labels) and pack or grid them within the frame.
Advanced Level:
Create a basic calculator interface using Tkinter, organized in a grid layout. The calculator should have
buttons for numbers (0-9), basic operations (+, -, *, /), and a button for calculating the result.
Change the number buttons to raised relief.
Change the background color to blue