import time
import os
from tkinter import *

splash_root = Tk()
splash_root.geometry("900x900")
splash_label = Label(splash_root, text='Please Wait, Setup is loading......')
splash_label.pack(pady=20)
splash_root.title('Loading Setup...')
def nb():
    splash_root.destroy()

splash_root.after(3000, nb)


mainloop()
with open('user/username.txt', 'w') as f:
    f.writelines("SebOSDefaultUser0")

with open('user/password.txt', 'w') as f:
    f.writelines("")
with open('user/siblings.txt', 'w') as f:
    f.writelines("?")

with open('user/age.txt', 'w') as f:
    f.writelines("?")
print("""
$$$$$$  $$$$$$  $$$$$     $$$$$$  $$$$$$
$       $       $    $    $    $  $
$$$$$$  $$$$$$  $$$$$     $    $  $$$$$$
     $  $       $    $    $    $       $
$$$$$$  $$$$$$  $$$$$     $$$$$$  $$$$$$
""")
print("""
[1]Continue With Setup
[2]I've Already done setup
""")
setup = input("[?]: ")
if setup == '1':
    name = input(str("Please enter your Username for login: "))
    pas = input(str("Please enter your password for login: "))
    age = input("How many years old are you? : ")
    siblings = input("How many siblings do you have? : ")

    with open('user/username.txt', 'w') as f:
        f.writelines(name)

    with open('user/password.txt', 'w') as f:
        f.writelines(pas)
    with open('user/age.txt', 'w') as f:
        f.writelines(age)
    with open('user/siblings.txt', 'w') as f:
        f.writelines(siblings)
    print("Setup Complete!")
    input("Click enter to start OS")
    os.startfile('home.py')
    sys.exit()

if setup == '2':
    login_pass = open('user/password.txt')
    login_name = open('user/username.txt')
    l_p = login_pass.read()
    l_n = login_name.read()

    while True:
        login = input(str("Please enter the password, " + l_n + ": "))
        if login == l_p:
            os.startfile('home.py')
            sys.exit()
        else:
            print("Incorrect!")
