Ejemplo n.º 1
0
#!/usr/bin/env python
import sys
if sys.version_info[0] < 3:
    import PySimpleGUI27 as sg
else:
    import PySimpleGUI as sg

# Here, have some windows on me....
[sg.PopupNoWait(location=(10 * x, 0)) for x in range(10)]

print(sg.PopupYesNo('Yes No'))

print(sg.PopupGetText('Get text', location=(1000, 200)))
print(sg.PopupGetFile('Get file'))
print(sg.PopupGetFolder('Get folder'))

sg.Popup('Simple popup')

sg.PopupNonBlocking('Non Blocking', location=(500, 500))
sg.PopupNoTitlebar('No titlebar')
sg.PopupNoBorder('No border')
sg.PopupNoFrame('No frame')
# sg.PopupNoButtons('No Buttons')        # don't mix with non-blocking... disaster ahead...
sg.PopupCancel('Cancel')
sg.PopupOKCancel('OK Cancel')
sg.PopupAutoClose('Autoclose')
Ejemplo n.º 2
0
        password = values['password']
        try:
            password_utf = password.encode('utf-8')
            sha1hash = hashlib.sha1()
            sha1hash.update(password_utf)
            password_hash = sha1hash.hexdigest()
            window.FindElement('hash').Update(password_hash)
        except:
            pass


# ----------------------------- Paste this code into your program / script -----------------------------
# determine if a password matches the secret password by comparing SHA1 hash codes
def PasswordMatches(password, hash):
    password_utf = password.encode('utf-8')
    sha1hash = hashlib.sha1()
    sha1hash.update(password_utf)
    password_hash = sha1hash.hexdigest()
    return password_hash == hash


login_password_hash = 'e5e9fa1ba31ecd1ae84f75caaa474f3a663f05f4'
password = sg.PopupGetText('Password', password_char='*')
if password == 'gui':  # Remove when pasting into your program
    HashGeneratorGUI()  # Remove when pasting into your program
    exit(69)  # Remove when pasting into your program
if PasswordMatches(password, login_password_hash):
    print('Login SUCCESSFUL')
else:
    print('Login FAILED!!')