Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

from tkinter import *from PIL import ImageTkfrom tkinter import messagebox class Login : def __init__ ( self , root) : self .root = root self

from tkinter import *from PIL import ImageTkfrom tkinter import messageboxclass Login: def __init__(self, root): self.root = root self.root.title("GREENeration") self.root.geometry("1199x600+100+50") self.root.resizable(False, False) self.bg = ImageTk.PhotoImage(file="images/bg3.png") self.plant = ImageTk.PhotoImage(file="images/plant.png") site_bg = Label(self.root, image=self.bg).pack() Frame_login = Frame(self.root, highlightbackground="white", highlightthickness=1) Frame_login.place(x=230, y=250, height=300, width=300) frame_bg = Label(Frame_login, image=self.plant).grid(row=0, column=0, padx=0.1, pady=0.1) login_here = Label(Frame_login, text="Login Here", font=("Times", 29, "italic", "bold"), fg="#409A2A").place(x=34, y=18) login_info = Label(Frame_login, text="Environmental Delegates Access Area", font=("Times", 10, "normal"), fg="#688859").place(x=36, y=65) user_name = Label(Frame_login, text="Username", font=("Times", 15, "normal"), fg="gray").place(x=34, y=97) self.txt_user = Entry(Frame_login, font=("Times", 15), bg="Lightgray") self.txt_user.place(x=38, y=120, width=230, height=35) user_password = Label(Frame_login, text="Password", font=("Times", 15, "normal"), fg="gray").place(x=34, y=155) self.txt_pass = Entry(Frame_login, font=("Times", 15), bg="Lightgray") self.txt_pass.place(x=38, y=178, width=230, height=35) self.txt_pass.config(show="\u2022") forgot_btn = Button(Frame_login, text="Forgot password?", cursor="hand2", fg="#409A2A", bd=0, font=("Times", 12)).place(x=34, y=256) Login_btn = Button(self.root, command=self.login_function, cursor="hand2", text="Sign in", bg="#409A2A", fg="white", bd=0, font=("Times", 12)).place(x=268, y=465, width=229, height=35) def login_function(self): if self.txt_pass.get() == "" or self.txt_user.get() == "": messagebox.showerror("Error!", "All fields are required.", parent=self.root) elif self.txt_pass.get() != "123456" or self.txt_user.get() != "Greta Thunberg": messagebox.showerror("Error!", "Invalid Username/Password", parent=self.root) else: messagebox.showinfo("Greeneration", f"Welcome {self.txt_user.get()}. Your Password: {self.txt_pass.get()}", parent=self.root)root = Tk()obj = Login(root)root.mainloop()

Hello, this is my gui and I want help in this. I don't know how to add the ENTER button. Like if the user prefers pressing the ENTER button instead of clicking SIGN IN, they could do that.

Below are the images I used.

image text in transcribedimage text in transcribed
\f\f

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

Enumerate the qualities of a salesman.

Answered: 1 week ago

Question

WHAT IS HRM?

Answered: 1 week ago

Question

(a+2)=81 then a=?

Answered: 1 week ago