python-eel / Eel

A little Python library for making simple Electron-like HTML/JS GUI apps
MIT License
6.44k stars 587 forks source link

If else statements #455

Closed notvasub closed 3 years ago

notvasub commented 3 years ago

I am trying to make an interactive "zoom joiner" application and am using EEL for the GUI. I want the application to make basically an if else statement so that when the use types in the class they want to join, it would join that specific class. I couldn't understand any way to do this so if anybody could help that would be great!

Python:

@eel.expose
def MathLogin(data):
    driver.maximize_window()
    driver.get(Math)
    time.sleep(2)
    pyautogui.click(x=901, y=254)
    driver.close()
    time.sleep(10)
    pyautogui.click(946, 256)
    notify(title='Joined',
           subtitle=' Zoom',
           message='You are now logged into Math... I hope you survive')

HTML:

    <div class="container-contact100">
        <div class="contact100-map" id="google_map" data-map-x="40.722047" data-map-y="-73.986422" data-pin="images/icons/map-marker.png" data-scrollwhell="0" data-draggable="1"></div>

        <div class="wrap-contact100">
            <form class="contact100-form validate-form">
                <span class="contact100-form-title">
                    Join Zoom
                </span>

                <div class="wrap-input100 validate-input" data-validate="Please enter the name of class">
                    <input class="input100" type="text" name="name" placeholder="Class Name">
                    <span class="focus-input100"></span>
                </div>

                <div class="container-contact100-form-btn">
                    <button class="contact100-form-btn" onclick="joinclass()">
                        Join
                    </button>
                </div>
            </form>
        </div>
    </div>

JavaScript:

function joinclass() {
    var data = document.getElementById("data").value
}

macOS 11 Big Sur Brave Browser Latest Version

cutethingg commented 3 years ago

I'm newer to python but a simple if and statement could go like this:

while True:
    if var == True:
        do something
        break
    else:
        exit()

Here's a good stack exchange answer on the topic:

https://stackoverflow.com/a/41205490/12345144