当我的GUI程序运行时,cmd打开

时间:2018-08-05 15:51:07

标签: python user-interface exe

通过pyinstaller将此代码转换为exe,但在工作窗口中,cmd也将打开。我应该如何解决?顺便说一句,我不太了解en_output / de_output中的参数是什么,但没有它,此代码将无法工作

from tkinter import *
from pyperclip import copy
symbs = list('E-P7Ъ&яGоЖРы*D;ЕФлеkХ4? 
rфlЙЦшFfH3R:8WyIЧCсpГ(6Щdzч"9хwМК0ъca№аtрзШ,СцдAкqoнгДэ'
                 '1.ТLbKЫmО!ЯUбBВXЁ%^юИQ2gOвsжeVН)щЗihSJnьNи/$MЮпxмП 
YЬБZ5jУvTйu#@ЛёуЭАт')


def cnvrtd_pass_in_nums(en_pass_var):
    pass_n = list()
    for i in en_pass_var:
        for number, sym in enumerate(symbs):
            if i == sym:
                pass_n.append(number)
        en_pass_var = list(pass_n)
    return list(en_pass_var)


def cnvrtd_key(en_key_var):
    key_n = list()
    for i in str(en_key_var):
        for number, sym in enumerate(symbs):
            if i == sym:
                key_n.append(number)
        en_key_var = int(sum(key_n) / len(key_n))
    return int(en_key_var)


def dec_pass(cnvrtd_pass_in_nums_var):
    p_v = list(cnvrtd_pass_in_nums_var)
    cnt = 0
    for i in range(len(p_v)):
        eh = p_v[cnt] - cnvrtd_key(en_key.get())
        if eh < 0:
            p_v[cnt] = len(symbs) + (p_v[cnt] - cnvrtd_key(en_key.get()))
        else:
            p_v[cnt] = eh
        cnt += 1
    return list(p_v)


def enc_pass(cnvrtd_pass_in_nums_var):
    e_p = list(cnvrtd_pass_in_nums_var)
    cnt = 0
    for i in range(len(e_p)):
        e_p[cnt] += int(cnvrtd_key(en_key.get()))
        if e_p[cnt] > (len(symbs) - 1):
            e_p[cnt] -= len(symbs)
        cnt += 1
    return list(e_p)


def fin_cnvrt(pass_n):
    cnt = int(0)
    stroka = str()
    for i in range(len(pass_n)):
        stroka = stroka + str((symbs[pass_n[cnt]]))
        cnt += 1
    return stroka


def en_output(hz):
    test_label['text'] = 
    fin_cnvrt(enc_pass(cnvrtd_pass_in_nums(en_pass.get("1.0",END))))
    copy(fin_cnvrt(enc_pass(cnvrtd_pass_in_nums(en_pass.get("1.0", END)))))


def de_output(hz):
    test_label['text'] = 
    fin_cnvrt(dec_pass(cnvrtd_pass_in_nums(en_pass.get("1.0",END))))
    copy(fin_cnvrt(dec_pass(cnvrtd_pass_in_nums(en_pass.get("1.0", END)))))


root = Tk()
root.title('crypto')
root.geometry('700x340')

pass_txt = Label(root, text='password', width=15, font=15)
key_txt = Label(root, text='key', width=15, font=15)
test_label = Label(root, text='test', width=60, font='Times 15', anchor = W)

en_button = Button(root, width=10, font=5, text='Encrypt')
de_button = Button(root, width=10, font=5, text='Decrypt')

en_pass = Text(root, wrap=WORD, width=49, height=10, font='Times 16')
en_key = Entry(root, width=49, font='Times 16')

pass_txt.place(x=5, y=33)
key_txt.place(x=25, y=3)
en_pass.place(x=120, y=30)
en_key.place(x=120, y=1)
de_button.place(x=10, y=70)
en_button.place(x=10, y=110)
test_label.place(x=20, y=280)

en_button.bind('<Button-1>', en_output)
de_button.bind('<Button-1>', de_output)


root.mainloop()

0 个答案:

没有答案