Sep-01-2020, 12:34 AM
(This post was last modified: Sep-01-2020, 07:11 AM by Gribouillis.)
Hey guys. What I'm trying to achieve is to output the text for the text string generator out to a text box on my GUI.
Im at my wits end with this haha. I would like the 'Generate' button to generate another password. As it stands. When you run the app. It outputs the generated password to the shell.
Im at my wits end with this haha. I would like the 'Generate' button to generate another password. As it stands. When you run the app. It outputs the generated password to the shell.
import random import string # get random string password with letters, digits, and symbols def get_random_password_string(length): password_characters = string.ascii_letters + string.digits + string.punctuation password = ''.join(random.choice(password_characters) for i in range(length)) print("Random Password:", password) get_random_password_string(8) from tkinter import * window=Tk() b1=Button(text="Generate") b1.grid(row=2,column=3) def redirector(inputStr): textbox.insert(INSERT, inputStr) title_text=StringVar() e3=Entry(window, textvariable="Author_text") e3.grid(row=2, column=0) l1=Label(window, text="Author: Sebz Technologies") l1.grid (row=1, column=0) l1=Label(window, text="Title: Password Generator") l1.grid (row=0, column=0) sys.stdout.write = redirector #whenever sys.stdout.write is called, redirector is called. window.mainloop()