基于Python編寫復(fù)雜密碼圖形化生成工具
Python 復(fù)雜密碼圖形化生成工具,支持選擇生成10位和12位復(fù)雜密碼(初版)
代碼
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2024/3/26 15:22 # @Author : wyq # @File : 部署測(cè)試.py import random import string from tkinter import * def generate_password(length): characters = string.ascii_letters + string.digits + string.punctuation password = ''.join(random.choice(characters) for _ in range(length)) return password def generate_selected_password(): length = var.get() password = generate_password(length) password_text.insert(END, password + '\n') # 插入密碼到文本框末尾,并換行 def default_password(): return "1qaz@WSX1234" def display_default_password(): password = default_password() password_text.insert(END, password + '\n') # 插入默認(rèn)密碼到文本框末尾,并換行 window = Tk() window.title("復(fù)雜密碼度生成器") window.geometry('500x300') bold_font = ('Arial', 12, 'bold') glob_label = Label(window, text='Password Length:', width=15, height=2, font=bold_font, fg='red') glob_label.grid(row=0, column=0, pady=10) window.grid_columnconfigure(0, weight=1) # 增加列權(quán)重 var = IntVar() length1 = Radiobutton(window, text='10', variable=var, value=10) length1.grid(row=1, column=0, pady=5) length2 = Radiobutton(window, text='12', variable=var, value=12) length2.grid(row=2, column=0, pady=5) generate_button1 = Button(window, text="生成密碼", command=generate_selected_password) generate_button1.grid(row=4, column=0, pady=10) generate_button2 = Button(window, text="默認(rèn)密碼", command=display_default_password) generate_button2.grid(row=5, column=0, pady=10) password_text = Text(window, height=10, width=30, wrap=WORD) password_text.grid(row=6, column=0, pady=10, padx=20) window.mainloop()
效果
到此這篇關(guān)于基于Python編寫復(fù)雜密碼圖形化生成工具的文章就介紹到這了,更多相關(guān)Python生成復(fù)雜密碼內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
解決每次打開(kāi)pycharm直接進(jìn)入項(xiàng)目的問(wèn)題
今天小編就為大家分享一篇解決每次打開(kāi)pycharm直接進(jìn)入項(xiàng)目的問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2018-10-10python3+selenium實(shí)現(xiàn)qq郵箱登陸并發(fā)送郵件功能
這篇文章主要為大家詳細(xì)介紹了python3+selenium實(shí)現(xiàn)qq郵箱登陸,并發(fā)送郵件功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2019-01-01Python 創(chuàng)建TCP服務(wù)器的方法
這篇文章主要介紹了Python 創(chuàng)建TCP服務(wù)器的方法,文中講解非常細(xì)致,代碼幫助大家更好的理解和學(xué)習(xí),感興趣的朋友可以了解下2020-07-07PyQt5重寫QComboBox的鼠標(biāo)點(diǎn)擊事件方法
今天小編就為大家分享一篇PyQt5重寫QComboBox的鼠標(biāo)點(diǎn)擊事件方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2019-06-06Python Django Vue 項(xiàng)目創(chuàng)建過(guò)程詳解
這篇文章主要介紹了Python Django Vue 項(xiàng)目創(chuàng)建過(guò)程詳解,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2019-07-07python的常見(jiàn)矩陣運(yùn)算(小結(jié))
這篇文章主要介紹了python的常見(jiàn)矩陣運(yùn)算(小結(jié)),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-08-08