dimanche 30 septembre 2018

How to check if only one statement equals 0 (python)?

I got some trouble with finding the matching if-statement to check if only one entry equals 0 of 3. Here's the code:

    def thanx(self):
    if len(self.e.get()) == 0:
        messagebox.showerror("Error", "Please enter affordable infos")
        self.boo = False
    else:
        messagebox.showinfo("Submition done", "Thank you")
        self.boo = True

It is only checking if my variable "e" equals 0, but i actually got 2 more entries. I know i could check every single one individually, however there has to be an easier way of doing this. Im using "tkinter" btw, but this shouldnt be too much important.

I tried it with "or" but this isnt working or I'm doing it wrong. (Also tried to solve this with lambda, but again just errors...)

Maybe someone can help me there...

Aucun commentaire:

Enregistrer un commentaire