Question

In: Computer Science

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 display saying, “No Text to Display.”

When the user clicks on the exit button, the program should terminate. Therefore, use the sys.exit() method from the sys package.

Solutions

Expert Solution

from tkinter import*
from tkinter import messagebox
import sys

root=Tk()

#Function to display the label

def selection():
a=e1.get()
if(len(a)==0):
output = "No Text to Display"
messagebox.showinfo("results",output)
else:
w=Label(root,text=a)
w.grid(row=0, column=1)

#function to exit

def end():
sys.exit()

e1=Entry(root)
e1.grid(row=0)
b1=Button(root,text='Submit',fg="Black",command = selection)
b1.grid(row=1)
b1=Button(root,text=' Exit ',fg="Black",bg="red", command = end)
b1.grid(row=1, column=1)
root.mainloop()


Related Solutions

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...
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.
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():...
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...
Question Objective: The objective of this lab exercise is to give you practice in programming with...
Question Objective: The objective of this lab exercise is to give you practice in programming with one of Python’s most widely used “container” data types -- the List (commonly called an “Array” in most other programming languages). More specifically you will demonstrate how to: Declare list objects Access a list for storing (i.e., writing) into a cell (a.k.a., element or component) and retrieving (i.e., reading) a value from a list cell/element/component Iterate through a list looking for specific values using...
This assignment is to give you practice using struts, arrays, and sorting. (Objective C++ and please...
This assignment is to give you practice using struts, arrays, and sorting. (Objective C++ and please have a screenshot of output) In competitive diving, each diver makes dives of varying degrees of difficulty. Nine judges score each dive from 0 through 10 in steps of 0.5. The difficulty is a floating-point value between 1.0 and 3.0 that represents how complex the dive is to perform. The total score is obtained by discarding the lowest and highest of the judges’ scores,...
Objective: The purpose of this programming assignment is to practice using STL containers. This problem is...
Objective: The purpose of this programming assignment is to practice using STL containers. This problem is selected from the online contest problem archive (Links to an external site.), which is used mostly by college students world wide to challenge their programming ability and to prepare themselves for attending programming contests such as the prestige ACM International Collegiate Programming Contest (Links to an external site.). For your convenience, I copied the description of the problem below with my note on the...
By using wider research, with reference to the theories and practice you must complete a company...
By using wider research, with reference to the theories and practice you must complete a company report, which analyses and evaluates ONE of the 3 following companies: 1) Airbus 2) Samsung 3) Tesla You must choose ONE of the companies and follow the below structure for your report: Introduction: write a brief company profile and introduce the company’s mission and vision, strategic goals, basic financial performance in the past 3 years. Pick one of the company’s key products and write...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT