#π need help with GUI
10 messages Β· Page 1 of 1 (latest)
@green crane
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
i want if the pin 'abc' is correct, in the terminal it prints "the password is correct" else it prints 'the password it's wrong'
Hey @green crane!
It looks like you are trying to paste code into this channel.
You seem to be using the wrong symbols to indicate where the code block should start. The correct symbols would be ```, not '''.
Here is an example of how it should look:
```py
print('Hello, world!')
```
This will result in the following:
print('Hello, world!')```
You can **edit your original message** to correct your code block.
from tkinter import *
from tkinter import ttk
root = Tk()
root.geometry("600x400")
root.title("mail")
root.resizable(False,False)
# metti email
label_email = Label(root, text='email')
email= StringVar()
email_entry = ttk.Entry(root, textvariable=email)
label_email.pack(padx=10,pady=5)
email_entry.pack()
email_entry.focus()#appena avvieremo il programma, l'input della email sarΓ
#giΓ selezionata
def cor():
if pin == 'abc':
print('corretto')
#metti password
pin = StringVar()
label_pin = Label(root, text='password')
pin_entry = Entry(root, textvariable=pin, show="*",command = cor())#show serve per censurare la password
label_pin.pack(padx=10,pady=5)
pin_entry.pack()
#invio
def login():
print(email_entry.get())
print(pin_entry.get()) #stampa nel terminale l'email e la password
conferma = Button(root, text='login', command=login)
conferma.pack()
root.mainloop()
i want if the pin 'abc' is correct, in the terminal it prints "the password is correct" else it prints 'the password it's wrong'
can someone help me?
do you want to check on every keypress or just when pressing login?
Just put the if statement in the login function and use the return value of pin_entry.get() as you've already done
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.