Question

Introduction The purpose of this assignment is to familiarize you with the writing Python scripts that demonstratest usage GU

Program Output The program will display the charges for the services checked. Sample Output Shown below is the output produce

for python

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code in text form, as well as screenshots, have been provided to verify indentation.

Code:

import tkinter as tk

from tkinter import messagebox

#function that called when Display Charges button is clicked

def dispCharges():

    #check if a radio button is selected and the entry field contains a value

    if minutes.get() != '' and v.get != 0:

        tk.messagebox.showinfo("Total Charges", f'Your total charges = {int(minutes.get()) * v.get()}')

#create a tkinter window

root = tk.Tk()

#v stores the radio button option selected

v = tk.DoubleVar()

#minutes stores the value entered in the entry field

minutes = tk.StringVar()

#create radiobuttons

tk.Radiobutton(root, text='Daytime(6:00am - 5:59pm)', variable=v, value=0.07).pack()

tk.Radiobutton(root, text='Evening(6:00pm - 11:59pm)', variable=v, value=0.12).pack()

tk.Radiobutton(root, text='Off-Peak(12:00am - 5:59am)', variable=v, value=0.05).pack()

#container for label and entry field

mframe = tk.Frame(root)

mframe.pack()

#create label

tk.Label(mframe,text='Enter the number of minutes: ').pack(side=tk.LEFT)

#create entery field

tk.Entry(mframe, width=10, textvariable=minutes).pack()

#container for buttons

buttonframe = tk.Frame(root)  

buttonframe.pack()

#create buttons in the the buttonframe

tk.Button(buttonframe, text='Display Charges', command=dispCharges).pack(side=tk.LEFT)

tk.Button(buttonframe, text='Quit', command=root.destroy).pack()

#loop gui program

tk.mainloop()

Code Screenshot

import tkinter as tk from tkinter import messagebox #function that called when Display Charges button is clicked def dispChar

Output Screenshot

- 0 x Daytime(6:00am - 5:59pm) Evening(6:00pm - 11:59pm) Off-Peak(12:00am - 5:59am) Enter the number of minutes: Display Char

- x Total Charges х Your total charges = 1.05 Daytime(6:00am - 5:59pm) Evening(6:00pm - 11:59pm) Off-Peak(12:00am - 5:59am) E

Add a comment
Know the answer?
Add Answer to:
for python Introduction The purpose of this assignment is to familiarize you with the writing Python...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • PYTHON PROGRAMMING LANGUAGE (NEEDED ASAP) Using a structured approach to writing the program: This section will...

    PYTHON PROGRAMMING LANGUAGE (NEEDED ASAP) Using a structured approach to writing the program: This section will guide you in starting the program in a methodical way. The program will display a window with GUI widgets that are associated with particular functions: Employee Payroll O X -- - - - - - - - - - - Show Payroll Find Employee by Name Highest Lowest Find Employee by Amount Write Output to Fie Cancel - -------- ------------- Notice that some of...

  • Using Python. Please help! The output should looks like below. Please follow the emphasis. I think...

    Using Python. Please help! The output should looks like below. Please follow the emphasis. I think it just prompt user to input course name. Write a modular program that creates a dictionary containing course numbers and the room numbers of the rooms where the courses meet. The dictionary should have the following key- value pairs: Course Number (key) Room Number (value) CS101 3004 CS102 4501 CS103 6755 NT110 1244 CM241 1411 The program should also create a dictionary containing course...

  • Kilobytes Systems has moved from Distribution of computer peripherals and accessories to provide Telephone a programmer...

    Kilobytes Systems has moved from Distribution of computer peripherals and accessories to provide Telephone a programmer to calculate and prints client's bill for services and has contracted you as cellular telephone usage. The kilobytes offers two types of service: golden and platinum. Its rates vary, depending on type of service. The rates are computed as follows: Golden service: 20.00 plus first 100 minutes are free charges for over 100 minutes are 20 cents per minute and 4 cents if you...

  • programming language: C++ *Include Line Documenatations* Overview For this assignment, write a program that will simulate...

    programming language: C++ *Include Line Documenatations* Overview For this assignment, write a program that will simulate a game of Roulette. Roulette is a casino game of chance where a player may choose to place bets on either a single number, the colors red or black, or whether a number is even or odd. (Note: bets may also be placed on a range of numbers, but we will not cover that situation in this program.) A winning number and color is...

  • Card Game Simulation(in Python 3.8.1) The purpose of this assignment is to help you gain experience...

    Card Game Simulation(in Python 3.8.1) The purpose of this assignment is to help you gain experience using while loops to solve problems. For this assignment, you will simulate a simplified card game that has some similarity to the game of 21. At the start of the program, the user will be asked to supply both the winning score (an integer from 1 thru 21) and the number of times to run the simulation (an integer from 100 to 100,000). To...

  • please do the program in simple programming it is for my first c++ computer class i...

    please do the program in simple programming it is for my first c++ computer class i posted the example on pic 2,3 which is how this should be done Write a program that calculates and prints the bill for a cellular telephone company. The company offers two types of services: regular and premium. Its rates vary depending on the type of service. The rates are computed as follows: Regular service: $10.00 plus the first 50 minutes are free. Charges for...

  • IN PYTHON Assignment Overview This assignment will give you experience on the use of classes. Understand...

    IN PYTHON Assignment Overview This assignment will give you experience on the use of classes. Understand the Application The assignment is to first create a class calledTripleString.TripleStringwill consist of threeinstance attribute strings as its basic data. It will also contain a few instance methods to support that data. Once defined, we will use it to instantiate TripleString objects that can be used in our main program. TripleString will contain three member strings as its main data: string1, string2, and string3....

  • -----------Python program------------------- Instructions: For this assignment, you will write complete a program that allows a customer...

    -----------Python program------------------- Instructions: For this assignment, you will write complete a program that allows a customer to plan for retirement. Part 2: Generate a Retirement Planning Table: It's hard to decide how much you need to save for retirement. To help your customer visualize how long her nest egg will last, write a program that allows the user to generate a retirement planning table showing the number of months the savings will last for various combinations of starting account balance...

  • Please write the python functions Problem: Electric wire (Figure is a cylindrical conductor covered by an...

    Please write the python functions Problem: Electric wire (Figure is a cylindrical conductor covered by an insulating material. Figure 2 shows the structure ofa single conductor. The resistance of a piece ofwire is given by the formula: A d where ρ is the resistivity of the conductor, and I (in meter), A, and d (in meter) are the length, cross-sectional area, and diameter of the wire. The wire diameter, d, is commonly specified by the American Wire Gauge (AWG). Which...

  • Background Colin Lake was a 53-year-old business man who presented to a Sydney hospital emergency department...

    Background Colin Lake was a 53-year-old business man who presented to a Sydney hospital emergency department one Friday evening with a unilateral, painful red eye. Colin used daily disposable contact lenses and reported that his right eye had been sore for 2 days. He had not removed his lens periodically as required throughout this time, thinking that taking his lenses off and on might make it worse. He presented with a bad headache and was unable to focus on his...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT