0% found this document useful (0 votes)
10 views3 pages

Import Tkinter

This document contains a Python script that creates a simple login interface using Tkinter for a fictional application called 'Women's World for Safety'. The interface includes fields for username and password, and provides feedback through message boxes upon successful or failed login attempts. The design features a dark background with pink and white text for visual appeal.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views3 pages

Import Tkinter

This document contains a Python script that creates a simple login interface using Tkinter for a fictional application called 'Women's World for Safety'. The interface includes fields for username and password, and provides feedback through message boxes upon successful or failed login attempts. The design features a dark background with pink and white text for visual appeal.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

import tkinter

from tkinter import messagebox

window = tkinter.Tk()
window.title(" Women's World for Safety ")
window.geometry('340x440')
window.configure(bg='#333333')

def login():
username = "johnsmith"
password = "12345"
if username_entry.get()==username and
password_entry.get()==password:
messagebox.showinfo(title="Login Success", message="You
successfully logged in.")
else:
messagebox.showerror(title="Error", message="Invalid login.")

frame = tkinter.Frame(bg='#333333')

# Creating widgets
login_label = tkinter.Label(
frame, text="Welcome to Women's Safety World!", bg='#333333',
fg="#FF3399", font=("Arial", 30))
username_label = tkinter.Label(
frame, text="Username", bg='#333333', fg="#FFFFFF",
font=("Arial", 16))
username_entry = tkinter.Entry(frame, font=("Arial", 16))
password_entry = tkinter.Entry(frame, show="*", font=("Arial", 16))
password_label = tkinter.Label(
frame, text="Password", bg='#333333', fg="#FFFFFF", font=("Arial",
16))
login_button = tkinter.Button(
frame, text="Login", bg="#FF3399", fg="#FFFFFF", font=("Arial",
16), command=login)

# Placing widgets on the screen


login_label.grid(row=0, column=0, columnspan=2, sticky="news",
pady=40)
username_label.grid(row=1, column=0)
username_entry.grid(row=1, column=1, pady=20)
password_label.grid(row=2, column=0)
password_entry.grid(row=2, column=1, pady=20)
login_button.grid(row=3, column=0, columnspan=2, pady=30)

frame.pack()

window.mainloop()

You might also like