create a graphical application that accept user inputs perform some operation on them and then writes the output on the screen for example write a small calculated use the tkinter library.
Answers
Python program that uses input to prompt a user for their name and then welcomes them.
Language Used : Python Programming (GUI - Tkinter)
Program :
import tkinter as tk
from tkinter import simpledialog
from tkinter import messagebox
root = tk.Tk()
root.withdraw()
username = simpledialog.askstring(title="Test",prompt="What's your Name?:")
#printing the statement on shell
print("Hello",username,"!")
#printing the statement on a message box
messagebox.showinfo("Greetings", "Hello "+str(username)+"!")
Input :
A pop-up window opens, asking for your name. You can see that in the attachments given below
Output :
On shell :
Hello Sarah!
On Message box :
See the attachments given below.
Explanation :
- All you need to do is, to import the libraries simpledialog and messagebox from tkinter.
- Then, use the function askstring() from simpledialog to get a pop-up asking for your name.
- Once you input your name, you can print it directly on the shell, or you can use showinfo() from messagebox, to greet using pop-up.
Note : I have added the attachments of the interpretation and the execution of programs with their outputs. Take a look!
Quick Tip : In python, you must and should follow Indentation. Following the indentation property in any programming language will help you in quickly analysing the code, if an error occurs.
Learn more :
- About GUI.
https://brainly.in/question/16402094
- Sailent features of python.
https://brainly.in/question/12206981
Hope it helped you! Cheers!
Answer:
Hello good morning everyone please follow kijia
Explanation:
here is ur answer