Python 3.x 我能';不要按login,因为它不会';不工作;它基本上什么也不做
这段代码肯定会抛出一些错误,但我假设您在这里重新键入了它,并且只犯了一些缩进和拼写错误,如果您按下enter按钮时它什么也不做,这就是您的错误:您从未调用函数Python 3.x 我能';不要按login,因为它不会';不工作;它基本上什么也不做,python-3.x,tkinter,Python 3.x,Tkinter,这段代码肯定会抛出一些错误,但我假设您在这里重新键入了它,并且只犯了一些缩进和拼写错误,如果您按下enter按钮时它什么也不做,这就是您的错误:您从未调用函数check\u user()。如果不需要将其作为函数,只需将其删除,并使该部分代码在enter()函数下运行即可: import sys from tkinter import * vrGui = Tk() vrGui.configure(bg="Yellow") vrGui.title("Spelling Bee") vrGui.
check\u user()
。如果不需要将其作为函数,只需将其删除,并使该部分代码在enter()函数下运行即可:
import sys
from tkinter import *
vrGui = Tk()
vrGui.configure(bg="Yellow")
vrGui.title("Spelling Bee")
vrGui.geometry("500x500+500+350")
label = Label(vrGui,text = "Student Login",font=("Britannic Bold", 18,"bold"))
label.configure (bg="Yellow")
label.place(x=160, y=45)
user = StringVar()
passw = StringVar()
with open("student.txt",mode="r",encoding="utf-8") as inFile:
student = inFile.read().splitlines()
def enter():
def check_user():
username = vrBox1.get()
password = vRBoX.get()
if username in student:
import starttest
entry1= Label(vrGui,text="Logged in")
entry1.place(x=250,y=250)
elif username not in student:
entry1= Label(vrGui,text="Incorrect")
entry1.place(x=250,y=250)
enter =Button(vrGui,text="Login",width=20,height=1,command=enter)
enter.place(x=200,y=240)
def Homescreen():
vrGui.destroy()
import startingpage
bkBut=Button(vrGui,text="Back to Homepage",width=20,height=1,command=Homescreen)
bkBut.place(x=200,y=280)
info_label=Label(vrGui, text="Enter Username and Password and press login", bg="yellow")
info_label.place(x=100,y= 150)
vrLabel = Label (text="Username", bg="yellow")
vrLabel.place(x=125,y=180)
vrBox1 = Entry()
vrBox1.place(x=200,y=180)
vRLabe2 = Label (text="Password", bg="yellow")
vRLabe2.place(x=125,y=210)
vRBox = Entry()
vRBox.place(x=200,y=210)
嗨,伙计,非常感谢,但上面说vRBox没有定义??彼得那是因为你一次拼vRBox,另一次拼vRBox。注意X
def enter():
username = vrBox1.get()
password = vRBoX.get()
if username in student:
import starttest
entry1= Label(vrGui,text="Logged in")
entry1.place(x=250,y=250)
elif username not in student:
entry1= Label(vrGui,text="Incorrect")
entry1.place(x=250,y=250)