-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import generator | ||
|
||
while True: | ||
generator.generate(input("How many usernames should be generated")) | ||
|
||
a = input("Generate more ? (y/n)") | ||
if a.lower() != "y": | ||
break | ||
print("\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import random | ||
|
||
with open("names.txt", "r") as file: | ||
names = file.read().split("\n") | ||
with open("surnames.txt", "r") as file: | ||
surnames = file.read().split("\n") | ||
with open("words.txt", "r") as file: | ||
random_words = file.read().split("\n") | ||
|
||
|
||
def generate(amount): | ||
randomUsernameList = [] | ||
try: | ||
for i in range(int(amount)): | ||
assets = [""] | ||
assets.append(str(random.randint(1, 1000))) | ||
assets.append(random.choice(names)) | ||
assets.append(random.choice(surnames)) | ||
assets.append(random.choice(random_words)) | ||
|
||
random.shuffle(assets) | ||
username = "" | ||
for j in assets: | ||
if random.randint(0, 2): | ||
username += j | ||
if username: | ||
randomUsernameList.append(username) | ||
for i in randomUsernameList: | ||
print(i) | ||
|
||
except ValueError as ve: | ||
print("Not a number") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import PySimpleGUI as sg | ||
import generator | ||
|
||
sg.theme("DarkGrey15") | ||
layout = [ | ||
[sg.Text("How many to generate : "), sg.In("", key="-AMOUNT-", size=(4, 1)), sg.Button("Generate", key="-GENERATE-")], | ||
[sg.Output(key="-OUTPUT-", size=(37, 6))] | ||
] | ||
|
||
window = sg.Window("Easy Username Generator", layout) | ||
|
||
while True: | ||
event, values = window.read() | ||
|
||
if event == sg.WIN_CLOSED: | ||
break | ||
if event == "-GENERATE-": | ||
generator.generate(values["-AMOUNT-"]) | ||
|
||
window.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
if __name__ == "__main__": | ||
def CLI(): | ||
import cli_handler | ||
|
||
def GUI(): | ||
import gui_handler | ||
|
||
GUI() | ||
#CLI() |