mardi 19 septembre 2017

Password Generator Isn't Working

I have a project in which I have to make a password checker and generator in python.

What I have done is made a GUI where there are buttons which you can select and access a function. For example "Quit" is to quit the program, I have done the password generator using random sampling with the combinations of allowed characters and total length of the password, however after I have tried to add a slider to manually change the password length I can't get it to work.

I have found few tutorials online but they were confusing as they didn't completely relate to the problem I have got.

Here is the code:

##IMPORT LIBRARIES
import random
import sys
from tkinter import *
##IMPORT LIBRARIES


##EXTRA (deletable content)
ABOUT_TEXT = """About

This program is made for the purpose of checking and generating passwords."""

DISCLAIMER = """
Disclaimer

Please don't copy my code in any kind of way. This took long to make.


Made by :

Wares Islam"""

PASS = """
The password is:
"""

enterPASS = """
Please input your password into the strenght checker
"""
##EXTRA(deletable content)



##PASSWORD GENERATOR
#allowed =     "abcdefghijklmnopqrstuvwxyz01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()?"
#pass_lenght = 12
#password =  ("".join(random.sample(allowed,pass_lenght )))
##PASSWORD GENERATOR



##PASSWORD CHECKER
checkPASS= str()
master= Tk()
##PASSWORD CHECKER


##FUNCTIONS
def clickAbout():
    toplevel = Toplevel()
    label1 = Label(toplevel, text=ABOUT_TEXT, height=0, width=100)
    label1.pack()
    label2 = Label(toplevel, text=DISCLAIMER, height=0, width=100)
    label2.pack()



def clickGenerate():
toplevel = Toplevel()
    allowed =     "abcdefghijklmnopqrstuvwxyz01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()?"
##  pass_lenght = 12
    password =  ("".join(random.sample(allowed,pass_lenght )))
    label3 = Label(toplevel, text=PASS, height=0, width=100)
    label3.pack()
    label4 = Label(toplevel, text= str(password), height=0, width=100)
    label4.pack()



def clickCheck():
    toplevel = Toplevel()
    label5 = Label(toplevel, text=enterPASS, height=0, width=100)
    label5.pack()
    input_entry = Entry(toplevel, show="*",)
    input_entry.pack()
##FUNCTIONS




##TKINTER WINDOW MENU
app = Tk()
app.title("Password Checker & Generator")
app.geometry("500x300+200+200")

label = Label(app, text="Password Checker & Generator", height=5, width=100)
b = Button(app, text="Quit Program", width=20, command=app.destroy)
button1 = Button(app, text="More INFO", width=20, command=clickAbout)
generate = Button(app, text="Generate",width=20, command=clickGenerate)
checker = Button(app, text= "Password Checker",width=20, command=clickCheck)
##TKINTER WINDOW MENU



##SLIDER PASSWORD GENERATOR LENGHT          [!!!NOT WORKING!!!]
#pass_lenght= int()
#labeltest = Label(app, text="Generator Letter Amount", height=0, width=100)
#labeltest.pack(side="bottom",padx=0,pady=0)
#slider = Scale(app, from_=8, to=24, orient=HORIZONTAL, variable=pass_lenght)
#slider.pack(side="bottom",padx=0,pady=0)
#slider.get()
##SLIDER PASSWORD GENERATOR LENGHT          [!!!NOT WORKING!!!]   



##TKINTER WINDOW MENU
label.pack()
generate.pack(side='bottom',padx=10,pady=5)
b.pack(side='bottom',padx=0,pady=0)
button1.pack(side='bottom',padx=5,pady=5)
checker.pack(side="bottom",padx=20,pady=0)

app.mainloop()
##TKINTER WINDOW MENU




Aucun commentaire:

Enregistrer un commentaire