samedi 27 mai 2017

How to make an if function work in a tkinter output box

The premise of my code is to ask for a password and the tkinter gui will return whether it thinks that it is secure or not. However, I cannot seem to get the if function displayed in the output box. Here is the code:

from tkinter import *

password = Tk()
password.title('Password tester')

Label(password, text="Password:").grid(row=1, column=0, sticky=W) 
entry= Entry(width=20, bg='light blue')
entry.grid(row=2, column=0, sticky=W)

def click():
entered_text = entry.get()
Button(password, text='SUBMIT',width=5
command=click).grid(row=3,column=0, sticky=W)

Label(password, text='\n\nPassword strength:').grid(row=4, column=0, sticky=W)

output = Text(password, width=75, height=6, wrap=WORD, background='light blue')
output.grid(row=5, column=0, columnspan=2, sticky=W)

if Label == 'password':
     print('This is a very insecure password.') in output

How can I get this function into the output box?

Aucun commentaire:

Enregistrer un commentaire