你好,我制作了自己的锁定屏幕,当我在py-charm中运行代码时,一切正常,并且很好,但是当我将其转换为exe时,提交按钮将不起作用。我99%肯定这不是从py到exe的转换,但我可能是错的。我认为这可能与if语句有关,但就像我说的那样,我毫无头绪。
# Imports
import tkinter
import webbrowser
from tkinter import *
def yes():
webbrowser.open('https://www.youtube.com/watch?v=XR_RmXtjrRI')
def no():
root.destroy()
def submit():
username = un.get()
password = ps.get()
if username.lower() in ['jackloza']:
if password.lower() in ['death']:
exit()
root = Tk()
var = StringVar()
label = Message(root, textvariable=var, relief=RAISED)
var.set("Please make sure you have the Windows Key Disabled before use."
" Do you need the Video to help?")
label.pack()
B = tkinter.Button(root, text="Yes", command=yes)
B.pack(side=LEFT)
C = tkinter.Button(root, text="No", command=no)
C.pack(side=RIGHT)
root.mainloop()
# Screen
Screen = tkinter.Tk()
Screen.title('Force Login')
Screen.attributes("-fullscreen", True)
Screen.configure(background='lightgrey')
var = StringVar()
label = Label(Screen, textvariable=var, relief=RAISED)
var.set("Welcome to the lock screen")
label.pack()
un = Entry(Screen, bd=5)
un.pack(side=TOP)
ps = Entry(Screen, bd=5, )
ps.pack(side=TOP)
L1 = Label(Screen, text="UserName").place(x=833, y=25)
L2 = Label(Screen, text='Passowrd').place(x=838, y=50)
Submit = tkinter.Button(Screen, text="Submit", command=submit)
Submit.pack()
Screen.mainloop()