The program should consist when after login successfully the image, name, nickname, favorite food and aritst will display after. When I run the code, the information wont display. The image will only display entirely. The code should consist of an image, name, favorite artist, favorite food, and favorite artist. ("random.jpg just appload a random pic to test) Code: from tkinter import * from tkinter import messagebox from PIL import ImageTk, Image # Create the main window root = Tk() root.title("Login") # Create the username label and entry field username_label = Label(root, text="Username:") username_label.grid(row=0, column=0) username_entry = Entry(root) username_entry.grid(row=0, column=1) # Create the password label and entry field password_label = Label(root, text="Password:") password_label.grid(row=1, column=0) password_entry = Entry(root, show="*") password_entry.grid(row=1, column=1) # Create the login button def login(): if username_entry.get() == "admin" and password_entry.get() == "password": messagebox.showinfo("Login", "Login Successful!") root.destroy() # Create the new window new_window = Tk() new_window.title("Welcome") # Load and display the image image = Image.open("random.jpg") photo = ImageTk.PhotoImage(image) image_label = Label(new_window, image=photo) image_label.pack() # Create the user information labels name_label = Label(new_window, text="Name: Doe") name_label.pack() address_label = Label(new_window, text="Address: 123 Main Street") address_label.pack() food_label = Label(new_window, text="Favorite Food: Pizza") food_label.pack() artist_label = Label(new_window, text="Favorite Artist: Beyonce") artist_label.pack() new_window.mainloop() else: messagebox.showerror("Login", "Invalid username or password") login_button = Button(root, text="Login", command=login) login_button.grid(row=2, column=1) root.mainloop()

Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter8: Arrays
Section: Chapter Questions
Problem 10RQ
icon
Related questions
Question

The program should consist when after login successfully the image, name, nickname, favorite food and aritst will display after. When I run the code, the information wont display. The image will only display entirely. The code should consist of an image, name, favorite artist, favorite food, and favorite artist. ("random.jpg just appload a random pic to test)

Code:

from tkinter import *
from tkinter import messagebox
from PIL import ImageTk, Image

# Create the main window
root = Tk()
root.title("Login")

# Create the username label and entry field
username_label = Label(root, text="Username:")
username_label.grid(row=0, column=0)
username_entry = Entry(root)
username_entry.grid(row=0, column=1)

# Create the password label and entry field
password_label = Label(root, text="Password:")
password_label.grid(row=1, column=0)
password_entry = Entry(root, show="*")
password_entry.grid(row=1, column=1)


# Create the login button
def login():
if username_entry.get() == "admin" and password_entry.get() == "password":
messagebox.showinfo("Login", "Login Successful!")
root.destroy()

# Create the new window
new_window = Tk()
new_window.title("Welcome")

# Load and display the image
image = Image.open("random.jpg")
photo = ImageTk.PhotoImage(image)
image_label = Label(new_window, image=photo)
image_label.pack()

# Create the user information labels
name_label = Label(new_window, text="Name: Doe")
name_label.pack()
address_label = Label(new_window, text="Address: 123 Main Street")
address_label.pack()
food_label = Label(new_window, text="Favorite Food: Pizza")
food_label.pack()
artist_label = Label(new_window, text="Favorite Artist: Beyonce")
artist_label.pack()

new_window.mainloop()
else:
messagebox.showerror("Login", "Invalid username or password")


login_button = Button(root, text="Login", command=login)
login_button.grid(row=2, column=1)

root.mainloop()

Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,