zoukankan      html  css  js  c++  java
  • python2.7写的图形密码生成器

    #coding:utf8
    import random,wx
    def password(event):
    a = [chr(i) for i in range(97,123)]
    b = [chr(i) for i in range(65,91)]
    c = ['0','1','2','3','4','5','6','7','8','9']
    d = ['!','@','#','$','%','^','&','*','(',')','=','_','+','/','?']

    set1 = a + b + c + d
    set2 = a + b + c
    num = int(length.GetValue())
    if switch.GetValue() == 0:
    passwd = ''.join(random.sample(set1,num))
    contents.SetValue(passwd)
    else:
    passwd = ''.join(random.sample(set2,num))
    contents.SetValue(passwd)
    app = wx.App()
    win = wx.Frame(None,-1,title=u'密码生成器',size=(480,200))
    bkg = wx.Panel(win,-1)

    # tt = wx.StaticText(bkg,-1,u'屏蔽输入字符')
    # delete = wx.TextCtrl(bkg,-1)


    right = wx.Button(bkg,-1,label=u'确定生成')
    right.Bind(wx.EVT_BUTTON,password)

    stxt = wx.StaticText(bkg,-1,u'请输入你的密码长度位数!' )
    length = wx.TextCtrl(bkg,-1,size=(50,27))
    switch = wx.CheckBox(bkg, -1,u'关闭特殊字符',(150, 20))

    sobx = wx.BoxSizer()
    sobx.Add(stxt,proportion=0,flag=wx.ALL,border=5)
    sobx.Add(length,proportion=1,border=5)
    sobx.Add(switch,proportion=0,flag=wx.ALL | wx.ALIGN_RIGHT,border=5)

    sobx.Add(right,proportion=0,flag=wx.EXPAND,border=5)

    contents = wx.TextCtrl(bkg,-1)
    cobx = wx.BoxSizer()
    cobx.Add(contents,proportion=1,flag=wx.EXPAND,border=5)

    dobx = wx.BoxSizer()

    # dobx.Add(delete,proportion=1,flag=wx.ALL,border=5)


    robx = wx.BoxSizer(wx.VERTICAL)
    robx.Add(cobx,proportion=1,flag=wx.EXPAND | wx.ALL,border=5)
    robx.Add(sobx,proportion=0,flag=wx.ALL,border=5)
    # robx.Add(dobx,proportion=0,flag=wx.EXPAND,border=5)

    bkg.SetSizer(robx)

    win.Show()
    app.MainLoop()




  • 相关阅读:
    [整理]弦图学习笔记
    [整理]NOI Online 2021第一场题解
    [整理]Pólya 定理入门到入土
    [游记]2021省选抱灵记
    [整理]一些好玩的/板子的动态规划题目
    [整理]网络流随记——终(有关网络流的一些杂项)
    [整理][持续更新]多项式知识点大全(超简洁!)
    [洛谷P4338][题解][ZJOI2018]历史
    [游记]WC2021游记
    Codeforces Round #703 (Div. 2) (A~E)
  • 原文地址:https://www.cnblogs.com/liumt-blog/p/11791904.html
Copyright © 2011-2022 走看看