Ich bin bisher noch ein anfänger für Python Programmierung, und habe erstmal versucht ein login in Tkinter zu machen, nun möchte ich(weil ich es momentan nicht alles weiß) eine erklärung. Könnt ihr mir helfen? Vielleicht Zeile für Zeile? so sieht der code aus:
import tkinter as tk #Importiert das Modul tkinter als tk
root = tk.Tk() #Erstelle das GUI-Fenster
root.geometry("350x600") #Stellt die größe und breite ein
root.title("Login") #gibt einen Titel
#root['bg'] = 'blue' mit diesem code kannst du die hintergrundfarbe ändern
show_face = "
hide_face = "
def show_hide_password(): #Erstellt eine neue funktion namens show_hide_password(Deutsch: Kennwort verbergen anzeigen)
if password_entry["show"] == "*": #Wenn in password_entry eingegeben wird, gebe als erstes * aus
password_entry.configure(show="")
show_hide_btn.configure(text=show_face)
else:
password_entry.configure(show="*")
show_hide_btn.configure(text=hide_face)
page_frame = tk.Frame(root)
user_name_lb = tk.Label(page_frame, text="User Name", font=("Bold", 15))
user_name_lb.pack(pady=10)
user_name_entry = tk.Entry(page_frame, font=("Bold", 15), bd=0)
user_name_entry.pack(pady=10)
password_lb = tk.Label(page_frame, text="Password", font=("Bold", 15))
password_lb.pack(pady=10)
show_hide_btn = tk.Button(root, text=hide_face, font=("Bold", 15), bd=0,
command=show_hide_password)
show_hide_btn.place(x=290, y=166)
password_entry = tk.Entry(page_frame, font=("Bold", 15), bd=0, show="*")
password_entry.pack(pady=10)
login_btn = tk.Button(page_frame, text="Login", font=("Bold", 15), bd=0,
bg="#158aff", fg="white")
login_btn.pack(pady=20)
page_frame.pack(pady=20)
page_frame.pack_propagate(False)
page_frame.configure(width=250, height=500)
root.mainloop()
LG