pyinstaller打包
本帖最后由 lawrence1357 于 2020-8-4 20:12 编辑我的代码是好几个py文件,为什么打包之后运行不了,求解??还有一个问题就是,Register类里面back函数为什么调用LoginPage会报错呢,NameError,如果这么写有问题,那请问这样的返回应该怎么写
from tkinter import *
from LoginPage import *
import os
if __name__ == '__main__':
with open(r'file/users/users.txt', encoding='UTF-8')as user:
users = user.readlines()
with open(r'file/clients/clients.txt', encoding='UTF-8')as client:
clients = client.readlines()
with open(r'file/admins/admins.txt', encoding='UTF-8')as admin:
admins = admin.readlines()
try:
os.makedirs(r'D:/荣辉地产/users')
os.makedirs(r'D:/荣辉地产/clients')
os.makedirs(r'D:/荣辉地产/invitationcode')
os.makedirs(r'D:/荣辉地产/admins')
os.makedirs(r'D:/荣辉地产/authorizationcode')
except FileExistsError:
pass
finally:
with open(r'D:/荣辉地产/users/users.txt', 'w', encoding='UTF-8')as w_users:
w_users.write('')
if users:
for user_info in users:
with open(r'D:/荣辉地产/users/users.txt', 'a', encoding='UTF-8')as w_users:
w_users.write(user_info)
with open(r'D:/荣辉地产/clients/clients.txt', 'w', encoding='UTF-8')as w_clients:
w_clients.write('')
if clients:
for clients_info in clients:
with open(r'D:/荣辉地产/clients/client.txt', 'a', encoding='UTF-8')as w_clients:
w_clients.write(clients_info)
with open(r'D:/荣辉地产/admins/admins.txt', 'w', encoding='UTF-8')as w_clients:
w_clients.write('')
if admins:
for admins_info in admins:
with open(r'D:/荣辉地产/admins/admins.txt', 'a', encoding='UTF-8')as w_admins:
w_admins.write(admins_info)
with open(r'D:/荣辉地产/invitationcode/invitationcode.txt', 'w', encoding='UTF-8')as w_invitationcode:
w_invitationcode.write('')
with open(r'D:/荣辉地产/authorizationcode/authorizationcode.txt', 'w',
encoding='UTF-8')as w_authorizationcode:
w_authorizationcode.write('')
root = Tk()
LoginPage(root)
root.mainloop()
from tkinter import *
from tkinter.messagebox import *
import re
from EnterPage import *
from Register import *
from FindBackPassword import *
class LoginPage:
def __init__(self, loginroot):
self.root = loginroot
self.root.title('登录')
self.root.minsize(360, 180)
self.root.maxsize(360, 180)
self.root.geometry('360x180+550-350')
self.createpage()
def createpage(self):
self.frame = Frame(self.root)
self.frame.pack()
Label(self.frame, text='用户名:', font=('幼圆', 11)).grid(row=0, sticky=W)
self.username = StringVar()
Entry(self.frame, textvariable=self.username).grid(row=0, column=1, columnspan=3, pady=20, ipadx=30, sticky=W)
Label(self.frame, text='密码:', font=('幼圆', 11)).grid(row=1, stick=W, pady=10)
self.password = StringVar()
Entry(self.frame, textvariable=self.password, show='*').grid(row=1, column=1, columnspan=3, pady=10, ipadx=30,
sticky=W)
self.admin_num = IntVar()
self.callback_password = Label(self.frame, text='忘记密码', fg='blue', cursor='hand2')
self.callback_password.grid(row=2, column=3, ipadx=10, pady=5, sticky=W)
self.callback_password.bind('<Button-1>', self.findback)
Checkbutton(self.frame, text='管理员登录 ', variable=self.admin_num).grid(row=2, column=1, columnspan=2,
ipadx=15, sticky=W)
self.admin_num.set(0)
Button(self.frame, text='登录', command=self.logincheck).grid(row=3, column=1, ipadx=10)
Button(self.frame, text='注册', command=self.register).grid(row=3, column=2, ipadx=10)
Button(self.frame, text='退出', command=quit).grid(row=3, column=3, ipadx=10)
def findback(self, event):
# self.root.gird_forget()
FindBackPassword(self.root)
def adminlogin(self):
pass
def logincheck(self):
print(self.admin_num.get())
if not self.admin_num.get():
with open(r'file/users/users.txt', encoding='UTF-8')as users_name_password:
users = users_name_password.readlines()
if users:
name = []
for user in users:
name.append(user.split(','))
if self.username.get() and self.password.get():
if self.username.get() in name:
for user in users:
if self.username.get() == user.split(','):
password = re.search(r'.*', user.split(',')).group()
if self.password.get() == password:
self.clear_entry()
self.frame.destroy()
EnterPage(self.root, user.split(','))
break
else:
self.clear_entry()
showinfo(title='错误', message='用户名或密码不正确!')
break
else:
self.name_notfound()
else:
showinfo(title='错误', message='用户名或密码不能为空!')
else:
self.name_notfound()
else:
with open(r'file/admins/admins.txt', encoding='UTF-8')as admin_name_password:
admins = admin_name_password.readlines()
if admins:
name = []
for admin in admins:
name.append(admin.split(','))
if self.username.get() and self.password.get():
if self.username.get() in name:
for admin in admins:
if self.username.get() == admin.split(','):
password = re.search(r'.*', admin.split(',')).group()
if self.password.get() == password:
self.clear_entry()
self.frame.destroy()
EnterPage(self.root, admin.split(','))
break
else:
self.clear_entry()
showinfo(title='错误', message='用户名或密码不正确!')
break
else:
showinfo(title='错误', message='"{}"不是管理员!'.format(self.username.get()))
else:
showinfo(title='错误', message='用户名或密码不能为空!')
else:
self.name_notfound()
def register(self):
self.frame.pack_forget()
Register(self.root)
def name_notfound(self):
showinfo(title='错误', message='用户名"{}"不存在!'.format(self.username.get()))
self.clear_entry()
def clear_entry(self):
self.username.set('')
self.password.set('')
from LoginPage import *
from tkinter.messagebox import *
from tkinter import *
import re
import os
import Main
class Register:
def __init__(self, register):
self.root = register
self.root.title('登录')
self.root.minsize(360, 280)
self.root.maxsize(360, 280)
self.root.geometry('360x280+550-350')
self.createpage()
def createpage(self):
self.frame = Frame(self.root)
self.frame.pack()
Label(self.frame, text='用户名:', font=('幼圆', 11)).grid(row=0, sticky=W)
self.username = StringVar()
Entry(self.frame, textvariable=self.username).grid(row=0, column=1, columnspan=3, pady=10, ipadx=30, sticky=W)
Label(self.frame, text='*', font=('幼圆', 10), fg='red').grid(row=0, column=4, pady=10, sticky=E)
Label(self.frame, text='密码:', font=('幼圆', 11)).grid(row=1, stick=W, pady=10)
self.password = StringVar()
Entry(self.frame, textvariable=self.password, show='*').grid(row=1, column=1, columnspan=3, pady=10, ipadx=30,
sticky=W)
Label(self.frame, text='*', font=('幼圆', 10), fg='red').grid(row=1, column=4, pady=10, sticky=E)
Label(self.frame, text='确认密码:', font=('幼圆', 11)).grid(row=2, stick=W, pady=10)
self.confirm_password = StringVar()
Entry(self.frame, textvariable=self.confirm_password, show='*').grid(row=2, column=1, columnspan=3, pady=10,
ipadx=30, sticky=W)
Label(self.frame, text='*', font=('幼圆', 10), fg='red').grid(row=2, column=4, pady=10, sticky=E)
Label(self.frame, text='密保问题:', font=('幼圆', 11)).grid(row=3, stick=W, pady=10)
self.password_question = StringVar()
Entry(self.frame, textvariable=self.password_question).grid(row=3, column=1, columnspan=3, pady=10,
ipadx=30,
sticky=W)
Label(self.frame, text='*', font=('幼圆', 10), fg='red').grid(row=3, column=4, pady=10, sticky=E)
Label(self.frame, text='密保答案:', font=('幼圆', 11)).grid(row=4, stick=W, pady=10)
self.password_answer = StringVar()
Entry(self.frame, textvariable=self.password_answer).grid(row=4, column=1, columnspan=3, pady=10,
ipadx=30,
sticky=W)
Label(self.frame, text='*', font=('幼圆', 10), fg='red').grid(row=4, column=4, pady=10, sticky=E)
self.admin_num = IntVar()
Checkbutton(self.frame, text='注册管理员', variable=self.admin_num).grid(row=5, column=2, columnspan=2, ipadx=15,
sticky=E)
Button(self.frame, text='注册', command=self.register_account).grid(row=6, column=1, ipadx=10)
Button(self.frame, text='返回', command=self.back).grid(row=6, column=2, ipadx=10)
Button(self.frame, text='退出', command=quit).grid(row=6, column=3, ipadx=10)
def register_account(self):
if self.username.get() and self.password.get() and self.confirm_password.get() and self.password_question.get() and self.password_answer.get():
if self.password.get() == self.confirm_password.get():
if self.admin_num.get():
admin_w_a = askyesno(title='系统提示', message='确定注册管理员?')
if admin_w_a:
self.pop_up_w = Toplevel()
self.pop_up_w.title('授权码验证')
self.pop_up_w.minsize(340, 130)
self.pop_up_w.maxsize(340, 130)
self.pop_up_w.geometry('340x130+560-360')
Label(self.pop_up_w, text='').grid(row=0, column=0, sticky=E)
Label(self.pop_up_w, text='授权码:', font=('幼圆', 11)).grid(row=1, column=0, sticky=E)
self.auth_code = StringVar()
Entry(self.pop_up_w, textvariable=self.auth_code).grid(row=1, column=1, ipadx=50, columnspan=2,
sticky=E)
Button(self.pop_up_w, text='确定', command=self.authverification).grid(row=2, pady=10, ipadx=10,
column=1)
Button(self.pop_up_w, text='取消', command=self.cancelfunc).grid(row=2, ipadx=10, column=2)
else:
self.pop_up_w = Toplevel()
self.pop_up_w.title('邀请码验证')
self.pop_up_w.minsize(340, 130)
self.pop_up_w.maxsize(340, 130)
self.pop_up_w.geometry('340x130+560-360')
Label(self.pop_up_w, text='').grid(row=0, column=0, sticky=E)
Label(self.pop_up_w, text='邀请码:', font=('幼圆', 11)).grid(row=1, column=0, sticky=E)
self.invi_code = StringVar()
Entry(self.pop_up_w, textvariable=self.invi_code).grid(row=1, column=1, ipadx=50, columnspan=2,
sticky=E)
Button(self.pop_up_w, text='确定', command=self.inviverification).grid(row=2, pady=10, ipadx=10,
column=1)
Button(self.pop_up_w, text='取消', command=self.cancelfunc).grid(row=2, ipadx=10, column=2)
else:
self.password.set('')
self.confirm_password.set('')
showinfo(title='错误', message='两次密码不一致!')
else:
showinfo(title='错误', message='*号空格为必填项!')
def cancelfunc(self):
self.pop_up_w.destroy()
def inviverification(self):
if self.invi_code.get():
code_invi = self.invi_code.get()
user_name = []
temporary_code = []
with open(r'file/authorizationcode/authorizationcode.txt', encoding='UTF-8')as code_r:
code_r_s = code_r.readlines()
for code in code_r_s:
temporary_code.append(re.search(r'\w*', code).group())
if code_invi in temporary_code:
with open(r'file/users/users.txt', encoding='UTF-8')as user:
users = user.readlines()
for user_user in users:
if user_user != '\n':
user_name.append(user_user.split(','))
if self.username.get() in user_name:
showinfo(title='错误', message='用户名已存在,请更换用户名!')
else:
temporary_admin = '{},{},{},{}\n'.format(self.username.get(), self.password.get(),
self.password_question.get(), self.password_answer.get())
with open(r'file/users/users.txt', 'a', encoding='UTF-8')as user_info:
user_info.write(temporary_admin)
self.pop_up_w.destroy()
showinfo(title='提示', message='注册成功,请重启程序登录!')
exit()
else:
showinfo(title='错误', message='邀请码不正确!')
else:
showinfo(title='错误', message='邀请码不能为空!')
def authverification(self):
if self.auth_code.get():
code_auth = self.auth_code.get()
admin_name = []
temporary_code = []
with open(r'file/authorizationcode/authorizationcode.txt', encoding='UTF-8')as code_r:
code_r_s = code_r.readlines()
for code in code_r_s:
temporary_code.append(re.search(r'\w*', code).group())
if code_auth in temporary_code:
with open(r'file/admins/admins.txt', encoding='UTF-8')as admin:
admins = admin.readlines()
for admin_user in admins:
if admin_user != '\n':
admin_name.append(admin_user.split(','))
if self.username.get() in admin_name:
showinfo(title='错误', message='管理员名称已存在,请更换管理员名称!')
else:
temporary_admin = '{},{},{},{}\n'.format(self.username.get(), self.password.get(),
self.password_question.get(), self.password_answer.get())
with open(r'file/admins/admins.txt', 'a', encoding='UTF-8')as admin_info:
admin_info.write(temporary_admin)
self.pop_up_w.destroy()
showinfo(title='提示', message='管理员注册成功,请重启登录!')
exit()
else:
showinfo(title='错误', message='授权码不正确!')
else:
showinfo(title='错误', message='授权码不能为空!')
def back(self):
self.frame.destroy()
LoginPage(self.root)
#这里调用LoginPage为什么会报错,说NameError: name 'LoginPage' is not defined
# .pack()
from tkinter import *
from tkinter.messagebox import *
from Client import *
import datetime
class EnterPage:
def __init__(self, mainpage, username):
self.root = mainpage
self.username = username
self.root.title('客户信息-录入系统 当前使用人员-{}'.format(self.username))
self.root.minsize(560, 256)
self.root.maxsize(560, 256)
self.root.geometry('560x256+480-380')
self.createpage()
def createpage(self):
self.frame = Frame(self.root)
self.frame.pack()
Label(self.frame).grid(row=0, rowspan=2)
Label(self.frame, text='客户姓名:', font=('幼圆', 11)).grid(row=4, column=0, pady=10, sticky=E)
self.client_name = StringVar()
Entry(self.frame, textvariable=self.client_name).grid(row=4, column=1, columnspan=3, ipadx=20)
Label(self.frame, text='*', font=('幼圆', 10), fg='red').grid(row=4, column=4, pady=10, sticky=E)
Label(self.frame, text='客户电话:', font=('幼圆', 11)).grid(row=5, column=0, pady=10, sticky=E)
self.client_phone = StringVar()
Entry(self.frame, textvariable=self.client_phone).grid(row=5, column=1, columnspan=3, ipadx=20)
Label(self.frame, text='*', font=('幼圆', 10), fg='red').grid(row=5, column=4, pady=10, sticky=E)
Label(self.frame, text='客户证件号:', font=('幼圆', 11)).grid(row=6, column=0, pady=10, sticky=E)
self.client_id = StringVar()
Entry(self.frame, textvariable=self.client_id).grid(row=6, column=1, columnspan=3, ipadx=20)
Label(self.frame, text='销售员:', font=('幼圆', 11)).grid(row=7, column=0, pady=10, sticky=E)
self.salesman = StringVar()
Entry(self.frame, textvariable=self.salesman, state='readonly').grid(row=7, column=1, columnspan=3, ipadx=20)
self.salesman.set(self.username)
Button(self.frame, text='保存', command=self.save).grid(row=8, column=1, pady=10, ipadx=10)
Button(self.frame, text='查询', command=self.find).grid(row=8, column=2, pady=10, ipadx=10)
Button(self.frame, text='退出', command=quit).grid(row=8, column=3, pady=10, ipadx=10)
def save(self):
if not (self.client_name.get() and self.client_phone.get()):
if not self.client_name.get() and self.client_phone.get():
showinfo(title='错误', message='客户姓名为必填项!')
elif self.client_name.get() and not self.client_phone.get():
showinfo(title='错误', message='客户电话为必填项!')
else:
showinfo(title='错误', message='*号为必填项!')
else:
if self.client_phone.get().isdigit() and len(self.client_phone.get()) == 11:
client_id = self.client_id.get()
if not client_id:
client_id = '未录入'
with open(r'file/clients/clients.txt', encoding='UTF-8')as client_info:
clients = client_info.readlines()
for client in clients:
if client != '\n':
if client.split(',') == self.client_phone.get():
salesman = re.search(r'.*', client.split(',')).group()
showinfo(title='错误',
message='手机号为"{}"的客户已存在,登记姓名为"{}",录入人员"{}"!'.format(
self.client_phone.get(),
client.split(','),
salesman))
self.clear_entry()
break
else:
t = str(datetime.datetime.now()).split('.')
with open(r'file/clients/clients.txt', 'a', encoding='UTF-8')as client:
client.write(
'{},{},{},{},{}\n'.format(self.client_name.get(), self.client_phone.get(),
client_id, self.salesman.get(), t))
showinfo(title='提示', message='保存成功!')
self.clear_entry()
else:
if len(self.client_id.get()) == 18:
with open(r'file/clients/clients.txt', encoding='UTF-8')as client_info:
clients = client_info.readlines()
for client in clients:
if client != '\n':
salesman = re.search(r'.*', client.split(',')).group()
if client.split(',') == self.client_phone.get() or client.split(',')[
2] == self.client_id.get():
if client.split(',') == self.client_phone.get() and client.split(',')[
2] == self.client_id.get():
showinfo(title='错误',
message='手机号为"{}",证件号为"{}"的客户已存在,登记姓名为"{}",录入人员"{}"!'.format(
self.client_phone.get(), self.client_id.get(),
client.split(','),
salesman))
self.clear_entry()
break
elif client.split(',') == self.client_phone.get() and client.split(',')[
2] != self.client_id.get():
showinfo(title='错误',
message='手机号为"{}"的客户已存在,登记姓名为"{}",录入人员"{}"!'.format(
self.client_phone.get(), client.split(','), salesman))
self.clear_entry()
break
elif client.split(',') != self.client_phone.get() and client.split(',')[
2] == self.client_id.get():
showinfo(title='错误',
message='证件号为"{}"的客户已存在,登记姓名为"{}",录入人员"{}"!'.format(
self.client_id.get(), client.split(','), salesman))
self.clear_entry()
break
else:
t = str(datetime.datetime.now()).split('.')
with open(r'file/clients/clients.txt', 'a', encoding='UTF-8')as client:
client.write(
'{},{},{},{},{}\n'.format(self.client_name.get(), self.client_phone.get(),
client_id, self.salesman.get(), t))
showinfo(title='提示', message='保存成功!')
self.clear_entry()
else:
showinfo(title='错误', message='证件号码错误!')
else:
showinfo(title='错误', message='电话号码错误!')
self.client_phone.set('')
def find(self):
self.frame.destroy()
Client(self.root, self.username)
def clear_entry(self):
self.client_name.set('')
self.client_phone.set('')
self.client_id.set('')
from tkinter import *
from tkinter import filedialog
from tkinter.messagebox import *
import re
import openpyxl
class Client:
def __init__(self, root, username):
self.username = username
self.root = root
self.root.title('客户信息-查询系统 当前使用人员-{}'.format(self.username))
self.root.minsize(995, 570)
self.root.maxsize(995, 570)
self.root.geometry('995x570+360-180')
self.createpage()
clients_info = self.find()
self.clear_text()
new_clients = []
for clients in clients_info:
if clients != '\n':
if self.username == clients.split(','):
new_clients.append(clients)
for new_client in new_clients:
information = '客户姓名:' + new_client.split(',') + '\t' + '客户电话:' + new_client.split(',')[
1] + '\t' + '客户证件号码:' + new_client.split(',') + '\t' + '销售员:' + \
new_client.split(',') + '\t' + '录入时间:' + new_client.split(',')
self.text.insert(END, information)
def createpage(self):
self.frame = Frame(self.root)
self.frame.pack(fill=BOTH)
Label(self.frame, text='通过姓名查询:').grid(row=0, column=0, padx=5, pady=5)
self.name = StringVar()
Entry(self.frame, textvariable=self.name).grid(row=0, column=1, padx=5, pady=5)
Button(self.frame, text='查询', command=self.namefind).grid(row=0, column=2, padx=5, pady=5)
Label(self.frame, text='通过电话查询:').grid(row=0, column=3, padx=5, pady=5)
self.phone = StringVar()
Entry(self.frame, textvariable=self.phone).grid(row=0, column=4, padx=5, pady=5)
Button(self.frame, text='查询', command=self.phonefind).grid(row=0, column=5, padx=5, pady=5)
Label(self.frame, text='通过证件查询:').grid(row=0, column=6, padx=5, pady=5)
self.id_nub = StringVar()
Entry(self.frame, textvariable=self.id_nub).grid(row=0, column=7, padx=5, pady=5)
Button(self.frame, text='查询', command=self.idfind).grid(row=0, column=8, padx=5, pady=5)
Button(self.frame, text='查询所有', command=self.allfind).grid(row=0, column=9, padx=5, pady=5)
self.text = Text(self.frame)
self.text.grid(row=1, column=0, columnspan=10, ipadx=210, ipady=80, padx=5, pady=5,
sticky=NSEW)
Button(self.frame, text='导出Excel', command=self.export).grid(row=2, column=9, padx=5, pady=5)
def export(self):
clients = self.find()
selfclients = []
excel_title = ['姓名', '联系方式', '证件号码', '营销人员', '登记时间']
workbook = openpyxl.Workbook()
worksheet = workbook.active
worksheet.append(excel_title)
for client in clients:
if client != '\n':
if self.username == client.split(','):
selfclients.append(client)
for selfclient in selfclients:
client_list = selfclient.split(',')
worksheet.append(client_list)
filepath = self.callback()
workbook.save(filepath)
def callback(self):
filepath = filedialog.asksaveasfilename(defaultextension='.xlsx', filetypes=[("XLSX", ".xlsx")])
return filepath
def find(self):
with open(r'file/clients/clients.txt', encoding='UTF-8')as client_info:
clients = client_info.readlines()
return clients
def namefind(self):
new_name = self.name.get().strip()
self.clear_text()
self.clear_entry()
if new_name:
clients = self.find()
new_clients = []
names = []
for client in clients:
if client != '\n':
if self.username == client.split(','):
new_clients.append(client)
names.append(client.split(','))
if new_name in names:
for new_client in new_clients:
if new_name == new_client.split(','):
information = '客户姓名:' + new_client.split(',') + '\t' + '客户电话:' + new_client.split(',')[
1] + '\t' + '客户证件号码:' + new_client.split(',') + '\t' + '销售员:' + \
new_client.split(',') + '\t' + '录入时间:' + new_client.split(',')
self.text.insert(END, information)
else:
showinfo(title='错误', message='未录入此客户!')
else:
showinfo(title='错误', message='查询索引不能空!')
def allfind(self):
clients_info = self.find()
self.clear_text()
new_clients = []
for clients in clients_info:
if clients != '\n':
if self.username == clients.split(','):
new_clients.append(clients)
for new_client in new_clients:
information = '客户姓名:' + new_client.split(',') + '\t' + '客户电话:' + new_client.split(',')[
1] + '\t' + '客户证件号码:' + new_client.split(',') + '\t' + '销售员:' + \
new_client.split(',') + '\t' + '录入时间:' + new_client.split(',')
self.text.insert(END, information)
def phonefind(self):
new_phone = self.phone.get().strip()
self.clear_text()
self.clear_entry()
if new_phone:
if len(new_phone) == 11 and new_phone.isdigit():
clients = self.find()
new_clients = []
phones = []
for client in clients:
if client != '\n':
if self.username == client.split(','):
new_clients.append(client)
phones.append(client.split(','))
if new_phone in phones:
for client in new_clients:
if new_phone == client.split(','):
information = '客户姓名:' + client.split(',') + '\t' + '客户电话:' + client.split(',')[
1] + '\t' + '客户证件号码:' + client.split(',') + '\t' + '销售员:' + \
client.split(',') + '\t' + '录入时间:' + client.split(',')
self.text.insert(END, information)
break
else:
showinfo(title='错误', message='未录入此号码!')
else:
showinfo(title='错误', message='输入非法的号码!')
else:
showinfo(title='错误', message='查询索引不能空!')
def idfind(self):
new_id = self.id_nub.get().strip()
self.clear_text()
self.clear_entry()
if new_id:
if len(new_id) == 18 or new_id == '未录入':
clients = self.find()
new_clients = []
ids = []
for client in clients:
if client != '\n':
if self.username == client.split(','):
new_clients.append(client)
ids.append(client.split(','))
if new_id in ids:
for new_client in new_clients:
if new_id == new_client.split(','):
information = '客户姓名:' + new_client.split(',') + '\t' + '客户电话:' + new_client.split(',')[
1] + '\t' + '客户证件号码:' + new_client.split(',') + '\t' + '销售员:' + \
new_client.split(',') + '\t' + '录入时间:' + new_client.split(',')
self.text.insert(END, information)
break
else:
showinfo(title='错误', message='未录入此证件号!')
else:
showinfo(title='错误', message='输入非法的证件号!')
else:
showinfo(title='错误', message='查询索引不能空!')
def clear_text(self):
self.text.delete(0.0, END)
def clear_entry(self):
self.name.set('')
self.phone.set('')
self.id_nub.set('')
重新打包试试 注意把杀毒软件关了再试试 1、打包问题:
确保代码没问题-->运行dist目录下的exe
如果还有问题,如下重新打包
1、在目录下新建__init__.py 2、输入打包指令,并指定要导入的第三方库路径,3、打包显示dll缺失,建议恢
复电脑,重新安装pyinstaller(只重新安装pyinstaller没用,本人亲自遇到)
static/image/hrline/line6.png
2、调用失败
因为你的模块名与方法名重复,建议import LoginPage as LP,再在代码里调用LP.LoginPage() 1q23w31 发表于 2020-8-4 20:34
1、打包问题:
确保代码没问题-->运行dist目录下的exe
如果还有问题,如下重新打包
不用这么复杂吧,把360和火绒关了就行了,否则就是代码本身的问题,这个代码太长了,我没仔细看
页:
[1]