Python Forum

Full Version: Help adding prompt text in a Layout using Rich TUI
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I'm trying to put my Login Screen inside a Panel or Layout using Rich (Rich Link)
and I've tried following the docs but I can't seem to put a prompt text in my layout.

I want to have the User and Password Prompt inside the layout but I'm stuck on how to do that?

Does anyone know how can this be done?

Thanks in advance.


the Login Function
#---------------------------------------------------------------
#                        Login Menu
#---------------------------------------------------------------
def login():
    while True:
        layout = Layout()
        layout.split_column(
        Layout(name="Login"))
        print(layout)
        print('\n=============================\n''\tLogin\n''=============================')
        user = Prompt.ask("[yellow]Enter your name (Case Sensitive) ")
        password = Prompt.ask("[yellow]Enter your password ") 
        #If the credentials are validated -> Run validate function -> Go to according menu
        #Else -> Print error message and show login screen again
        if validate(user, password):
            break
        else:
            invalidCredentials = Text('\nYou are not registered to use this program')
            invalidCredentials.stylize("bold red")
            print(invalidCredentials)
#---------------------------------------------------------------
Rich is intended for use in the terminal.
I know, I just want to put a box around the prompt.ask text that is being displayed to the terminal
Something like this: Example/Reference Img