国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁(yè)技術(shù)文章
文章詳情頁(yè)

用python寫一個(gè)帶有g(shù)ui界面的密碼生成器

瀏覽:117日期:2022-07-06 09:52:11

需要用到的庫(kù):

tkinter:構(gòu)建gui界面

pyperclip:復(fù)制功能

random:生成隨機(jī)數(shù)

string:處理字符串

代碼:

from tkinter import *import random, stringimport pypercliproot =Tk()root.geometry('400x400')root.resizable(0,0)root.title('密碼生成器')heading = Label(root, text = ’密碼’ , font =’arial 15 bold’).pack()pass_label = Label(root, text = ’密碼長(zhǎng)度’, font = ’arial 10 bold’).pack()pass_len = IntVar()length = Spinbox(root, from_ = 8, to_ = 32 , textvariable = pass_len , width = 15).pack()pass_str = StringVar()def Generator(): password = ’’ for x in range (0,4): password = random.choice(string.ascii_uppercase)+random.choice(string.ascii_lowercase)+random.choice(string.digits)+random.choice(string.punctuation) for y in range(pass_len.get()- 4): password = password+random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits + string.punctuation) pass_str.set(password) Button(root, text = '獲取密碼' , command = Generator ).pack(pady= 5)Entry(root , textvariable = pass_str).pack()def Copy_password(): pyperclip.copy(pass_str.get())Button(root, text = ’復(fù)制密碼’, command = Copy_password).pack(pady=5)root.mainloop()

運(yùn)行效果:

用python寫一個(gè)帶有g(shù)ui界面的密碼生成器

想要了解更多關(guān)于python的知識(shí),資訊,實(shí)用工具歡迎關(guān)注python客棧

用python寫一個(gè)帶有g(shù)ui界面的密碼生成器

以上就是用python寫一個(gè)帶有g(shù)ui界面的密碼生成器的詳細(xì)內(nèi)容,更多關(guān)于python gui密碼生成器的資料請(qǐng)關(guān)注好吧啦網(wǎng)其它相關(guān)文章!

標(biāo)簽: Python 編程
相關(guān)文章:
主站蜘蛛池模板: 贵定县| 许昌市| 青阳县| 延长县| 库尔勒市| 天等县| 土默特左旗| 峨边| 固阳县| 郯城县| 黄冈市| 吴旗县| 贡觉县| 尼木县| 南澳县| 岑巩县| 衡阳县| 呼玛县| 德兴市| 莆田市| 绍兴市| 陵川县| 社旗县| 尚志市| 嵩明县| 莫力| 容城县| 泸州市| 同心县| 卫辉市| 德庆县| 卫辉市| 盘山县| 宣武区| 临颍县| 苏州市| 西青区| 保康县| 肇庆市| 府谷县| 怀集县|