Ich habe ein Hauptfenster und habe ein Popup-Fenster 'Logwind' in der Funktion 'log_window' erstellt. Ich möchte dem Fenster von außerhalb der Funktion Eingabefälle hinzufügen, aber ich erhalte immer wieder einen Namensfehler. Wie kann ich dies codieren, damit ich Änderungen am Fenster außerhalb der Funktion vornehmen kann? < /P>
from tkinter import *
import tkinter.messagebox as box
tscreen = Tk()
tscreen.title("welcome to revise biology")
# sets window size
tscreen.geometry("1600x1024")
# insert my picture
# reads the image
image = Image.open("C:/Users/Amara/Downloads/pixel_art (1).png")
resize_img = image.resize((1300,700))
img = ImageTk.PhotoImage(resize_img)
# to show image
label1 = Label(image = img)
label1.image = img
label1.pack()
#adds text to the screen
label2 = Label(tscreen, text="welcome to revise
biology",bg="#e6d192")
label2.config(font=("Courier New",15))
label2.place(x=480,y=80)
def log_window():
global logwind
logwind = Toplevel(tscreen)
logwind.title("login/sign in")
logwind.geometry("600x400")
sbg = Image.open("C:/Users/Amara/Downloads/pixel_art (3).png")
sbg = sbg.resize((600, 400))
sl_bg_img = ImageTk.PhotoImage(sbg)
sl_label3 = Label(logwind, image = sl_bg_img)
sl_label3.image = sl_bg_img
sl_label3.pack()
label4 = Label(logwind, text="please login or sign up to continue", bg= "#e6d192")
label4.config(font=("Courier New", 10))
label4.place(x=160, y=50)
#return
button1 = Button(label1, text="continue",bg= '#fce5cd', command=log_window)
button1.place(x=580,y=250)
button1.config(font=("Courier New",15))
user_n = StringVar()
pass_w = StringVar()
def user_details():
user = user_n.get()
passw = pass_w.get()
user_n.set("")
pass_w.set("")
#makes text and entry box visible in logwind window
sign_up = Label(logwind, text="sign up")
s_user_lab = Label(logwind,text = "username: ", font=("Courier New", 10))
s_user_inp = Entry(logwind, textvariable= user_n, font=("Courier New", 10))
pass_lab = Label(logwind, text = "password: ",font=("Courier New", 10))
#makes text visible in logwind window and entry box made which displays each character
#as asteriks
pass_inp = Entry(logwind, textvariable= pass_w, show="*",font=("Courier New", 10))
ud_button = Button(logwind, text ="enter")
frame = Frame(log_window())
entry = Entry(frame)
tscreen.mainloop()
< /code>
Titelbildschirm meines Programms,
Popup-Fenster, in dem ich möchte, dass meine Einstiegsboxen auf
Das 2. Bild haben, das ich habe, bevor ich angefangen habe, die Einstiegskästen zu codieren. < /p>
Wie kann ich dem Fenster von außerhalb der Funktion Eingabefälle und andere Widgets hinzufügen (TKinter) ⇐ Python
-
- Similar Topics
- Replies
- Views
- Last post
-
-
Wie funktioniert Destructor beim Schließen eines Tkinter -Toplevel -Widgets?
by Anonymous » » in Python - 0 Replies
- 9 Views
-
Last post by Anonymous
-
-
-
Identische Tkinter -Text -Widgets, wenn Schriftstil und Größe geändert werden
by Anonymous » » in Python - 0 Replies
- 20 Views
-
Last post by Anonymous
-