Question

In: Computer Science

Python Using tkinter, create a GUI interface which accepts input of a GPA. If the GPA...

Python

Using tkinter, create a GUI interface which accepts input of a GPA.

If the GPA is >= 3.5, display 'Dean’s List'

If the GPA is < 2.0, display 'Probation’

If the GPA is < 3.5 and >= 2.0, display 'Regular Standing'

Run one test case for each case above and save the output.

Solutions

Expert Solution

PLEASE NOTE : FEEL FREE TO ASK ANY DOUBTS by COMMENTING

  • If you want me to change anything, Please let me know by commenting.
  • I used comments for better understanding. Comments starts with ' # '
  • Please refer to the screenshot of the code to understand the indentation of the code

Language : Python

:::::::::::::::::::::::::::::::::::::::::::: CODE ::::::::::::::::::::::::::::::::::::::::

from tkinter import *

# Function to set Result Label text
def callback(sv,label):

# try - except block to avoid errors
try:
# if entry value is null, set label text as belo
if(sv.get().strip()==""):
label.set("Enter GPA")
return

# if entry value is not null, conver value to float
gpa = float(sv.get())

# to store result text
result = ""

# assign result text as rules
if(gpa>=3.5):
result = "Dean’s List"
elif(gpa<3.5 and gpa>=2.0):
result = "Probation"
else:
result = "Regular Standing"

# set label text to result value
label.set(result)

except ValueError:
# if any value error occured, set label as Invalid gpa
label.set("Invalid GPA")

# main function
def main():
# create tkinter object
root = Tk()
# set window title, size of width 300 and heigth 200
root.title("GPA")
root.geometry("300x200")

# set window to non resizable
root.resizable(0,0)

# creating StringVar for window. one for entry, one for result label
sv = StringVar()
result = StringVar(root)

# trace StringVar to call callback with both StringVar above
# this trace changes in Entry of GPA value
sv.trace("w", lambda name, index, mode, sv=sv: callback(sv,result))

# create label at x-axis 10 and y-axis 20
Label(root,text="Enter GPA : ",font=(12)).place(x=10,y=20)

# create entry box at x-axis 100 and y-axis 20 and set textvariable to StringVar "sv"
Entry(root, textvariable=sv,font=(12)).place(x=100,y=20)

# create label for result label, at x-axis 150 and y-axis 100 and set anchor to center
# and set textvariable to StringVar "result"
Label(root,textvariable=result,font=(12)).place(x=150,y=100,anchor="center")

# run window
root.mainloop()

# Call above main method
main()
:::::::::::::::::::::::::::::::::::::::::::: OUTPUT ::::::::::::::::::::::::::::::::::::::::

No GPA Entered/ Only whitespaces

Entered Value for Regular Standing

Entered Value for Probation

Entered Value for Dean's List

Entered Invalid Value/Characters

:::::::::::::::::::::::::::::::::::::: CODE in EDITOR ::::::::::::::::::::::::::::::::::

_________________________________________________________________

Dear Friend, Feel Free to Ask Any Doubts by Commenting. ASAP i'll respond when i'm available.

I'm on a critical Situation. Please Do Not Forget To Give A Thumbs UP +1. It will Helps me A Lot.

Thank YOU :-)


Related Solutions

Using tkinter, create a GUI interface which accepts input of annual income. Using the table below,...
Using tkinter, create a GUI interface which accepts input of annual income. Using the table below, determine and output the income tax for that income. Tax Rate Income 10% $0 to $9,875.00;  12% $9,876.01 to $40,125.00; 22% $40,126 to $85,525.00; 24% $85,526.01 to $163,300.00. Test with the following income data: 163,300.00 9,876.01 85,525.00
I NEED TO CREATE A GUI INTERFACE USING TKINTER CONTAINING : Colors, Image, Button, Title bar,...
I NEED TO CREATE A GUI INTERFACE USING TKINTER CONTAINING : Colors, Image, Button, Title bar, and a Menu bar FOR THE QUESTION BELOW: PLEASE HELP PROGRAMMING LANGUAGE IS PYTHON Write a simple quiz game that has a list of ten questions and a list of answers to those questions. The game should give the player four randomly selected questions to answer. It should ask the questions one-by-one, and tell the player whether they got the question right or wrong....
Python Create a tkinter GUI application that has two buttons on it. The first button should...
Python Create a tkinter GUI application that has two buttons on it. The first button should have in red text the word "Red" on it and the second button should have in blue text the word "Blue" on it. When the red button is clicked you should change the background color of the application window to red and when the blue button is pressed you should change the background color of the application window to blue. You should place your...
Using Tkinter for GUI, A Python program that will allow the user to perform (i) generate...
Using Tkinter for GUI, A Python program that will allow the user to perform (i) generate RSA keys, (ii) encrypt a given message and (iii) decrypt the message without using any cryptographic library. Your program will generate the values of p unless the user provides them manually. Then the program will generate the keys (private and public). Then the program will allow the user to enter his/her message to be encrypted. Finally, the program will perform the decryption operation as...
The objective of this project is to practice using Pythons GUI tkinter. You must use tkinter...
The objective of this project is to practice using Pythons GUI tkinter. You must use tkinter and no other GUI product. Design a small (ie 2x3) GUI window which contains 4 items: 1. A text keyin field, 2. An Execute button, 3. An Exit Button 4. A label. When the user clicks on the execute button, the text located in the keyin field will be displayed on the label. If the keyin field contains no text, a message box should...
I did the complete programming in python , just want to use tkinter for GUI. please...
I did the complete programming in python , just want to use tkinter for GUI. please look at the 2nd part . i did some part of this program using tkinter but could not finis it. Thank you. import random image = 'w' # modified functions which accepts two numbers each and returns the respective # output def add(a, b): return a + b def subtract(a, b): return a - b def multiply(a, b): return a * b def kidCalc():...
In python using tkinter, I want to create a program. The program can have various classes...
In python using tkinter, I want to create a program. The program can have various classes and methods but I want it to have circles, triangles, and squares. Each shape movies in a certain way, like circles can move linearly, triangles can be affected by gravity, and squares can only go up and down. If the shapes get too close to one another then they disappear and a new shape appears somewhere else. I want this program to run continuously.
PYTHON PROGRAMMING Using tktinker, create a gui that surrounds the code below that has buttons and...
PYTHON PROGRAMMING Using tktinker, create a gui that surrounds the code below that has buttons and labels and an overall theme. # Meet the chatbot Eve print('Hi there! Welcome to the ChatBot station. I am going to ask you a series of questions and all you have to do is answer!') print(' ') print('Lets get started') #begin questions firstName = input('What is your first name?: ') lastName = input('What is your last name? ') print("Hi there, ", firstName + lastName,...
Use the below info to create a java program A GUI interface to ensure a user...
Use the below info to create a java program A GUI interface to ensure a user is old enough to play a game. Properly formatted prompts to input name, address, phone number, and age. Remember that name, address, phone number, etc. can be broken out in additional fields. Refer to the tutorial from this week’s Reading Assignment Multiple vs. Single Field Capture for Phone Number Form Input for help with this. Instructions to ensure that the information is displayed back...
modify the code below to create a GUI program that accepts a String from the user...
modify the code below to create a GUI program that accepts a String from the user in a TextField and reports whether or not there are repeated characters in it. Thus your program is a client of the class which you created in question 1 above. N.B. most of the modification needs to occur in the constructor and the actionPerformed() methods. So you should spend time working out exactly what these two methods are doing, so that you can make...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT