
用 python tkinter 写了个 Windows 桌面程序, 想做个登录界面,用户登录通过以后再跳转到主界面。找了很久终于找到一个能达到目的的方法,但是不知道这个方法是否存在安全隐患,也就是说用户能轻松跳过验证直接显示主界面。顺便说一下这个程序会编译成 exe 。以下是原理:
import tkinter as tk root = tk.Tk() root.geometry('500x300') #In order to hide main window root.withdraw() tk.Label(root, text="Main Window").pack() aWindow = tk.Toplevel(root) aWindow.geometry('200x100') def change_window(): #remove the other window entirely aWindow.destroy() #make root visible again root.iconify() root.deiconify() username = tk.StringVar() tk.Entry(aWindow, textvariable=username).pack() tk.Button(aWindow, text="Login", command=change_window).pack() root.mainloop() 欢迎大佬们指点,多谢!
1 no1xsyzy 2020 年 6 月 4 日 Python 一般没有真 exe |
2 chengxiao 2020 年 6 月 4 日 真的要用 Python 写 GUI 的话,还是去看下 PyQT 吧 tk 折腾过一段时间发现实在是太难用了 |
4 XIVN1987 2020 年 6 月 4 日 Tk 的界面这么丑,我不明白 Python 为啥一定要带着它 真觉得 GUI 必须,,换个好看点儿的不行吗??哪怕功能简陋些也许啊 |
5 panzhangwang 2020 年 6 月 5 日 |
6 ungrown 2020 年 10 月 15 日 |