## Monday, August 31, 2020

Solution Exercise 199: a python tkinter dialog box that display welcome to user

#### Exercise 199 || Solution

Create a Python program using the Tkinter library, which displays a dialog box that ask user to type his name and display a dialog box asking him to enter his name and displays the welcome message followed by his name as shown in the figure below.

#### Solution

``````from tkinter import *

def action():
name = entryName.get()
lblDisplay['text'] = "Welcome " + name + " !"
# You can also use the following syntax :
#lblDisplay.configure(text = "Welcome " + name + " !")

root = Tk()
root.geometry("375x150")

# Create Label and Entry Name
lblName = Label(root , text= "Enter your name : " , width = 20 )
lblName.place(x = 10 , y = 20)
entryName = Entry(root, width = 25)
entryName.place(x = 175 , y = 20)

# Create label to display result
lblDisplay = Label(root , text='...........')
lblDisplay.place(x = 175 , y = 100)

# Create button to execute action
btnAction = Button(root , text = "Validate" , width = 25 , command = action)
btnAction.place(x = 175 , y = 50)

root.mainloop()
``````

Younes Derfoufi
my-courses.net

## Python Exercises With Solutions

1. Python Arithmetic Exercises
2. Equations & System Of Equations
3. Polynomials and Functions
4. Python Arithmetic Exercises
5. Numpy, Matplolib, Sympy , Scipy - Exercises
6. Python Arithmetic Exercises

Younes Derfoufi