Skip to content

043-working-with-entry-widgets-C4rTank created by GitHub Classroom

Notifications You must be signed in to change notification settings

sdcst/043-working-with-entry-widgets-C4rTank

Repository files navigation

SDSS Computing Studies Python Assignment

Assignment #009b Input and Output with TKinter (12 marks)

Objectives:

  • Get input from a tkinter Entry widget using Entry.get()
  • Put data into a tkinter entry widget using Entry.insert()
  • Remove contents of an entry widget using Entry.delete()
  • Update the contents of a label using textvariable instead of text
  • Add an event to a button using the command option

A GUI is supposed to make input and output easier for the user, so we had better learn how to send and receive data from some of the widgets.

Today, we will be looking at creating our first event driven programs that use the command option for button widgets. This allows us to have the program execute specific code when the button is clicked.

Some of the code that we will be executing today involves retrieving data from an Entry widget and doing something with it. This is how our GUI will receive its input. However, we will also need to produce output, so we will be using the Entry.insert() and Entry.delete() methods to help us update the contents of an Entry widget.

3 Tasks (8 points)

Task 1 (4 points)

Create entry widets to allow user to enter their:

  • name
  • student number
  • grade Create a button so that when they click on the button, it states all of the information in a 4th entry widget
Task 2

Create a window with 3 entry widgets and 1 button. The first 2 entry widgets allow the user to enter in the 2 short sides of a right triangle. When the button is clicked, calculate the length of the hypotenuse and display it in the 3rd entry widget. Any labels you need for instruction are optional. (4 points)

About

043-working-with-entry-widgets-C4rTank created by GitHub Classroom

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages