Python Forum
Help adding prompt text in a Layout using Rich TUI
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help adding prompt text in a Layout using Rich TUI
#1
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)
#---------------------------------------------------------------
Reply
#2
Rich is intended for use in the terminal.
Reply
#3
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Rich output to PDF HEbO61 1 195 Apr-16-2024, 07:30 AM
Last Post: Pedroski55
  Can rich.logging output to file? pyfoo 1 277 Mar-21-2024, 10:30 AM
Last Post: pyfoo
  Help with TypeWriter Effect in Python Rich Extra 0 1,183 May-23-2022, 09:44 PM
Last Post: Extra
  Adding markers to Folium map only adding last element. tantony 0 2,135 Oct-16-2019, 03:28 PM
Last Post: tantony
  Python QGIS tool that replaces layout text labels with attributes from an input table geodenn92 1 2,691 Aug-13-2019, 06:05 AM
Last Post: buran
  Adding a paragraph of text before an exercise oldDog 5 3,612 May-22-2018, 06:57 PM
Last Post: oldDog
  Adding text to plots shaynehansen 0 3,333 Jul-10-2017, 05:54 PM
Last Post: shaynehansen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020