Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import curses
- import webbrowser
- def main(stdscr):
- curses.curs_set(0) # Hide the cursor
- stdscr.clear() # Clear the screen
- # Define the pattern
- pattern = [
- "░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓███████▓▒░ ░▒▓█▓▒░",
- "░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ ░▒▓████▓▒░",
- "░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░",
- "░▒▓████████▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓███████▓▒░ ░▒▓█▓▒░",
- "░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░",
- "░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓██▓▒░▒▓█▓▒░",
- "░▒▓█▓▒░░▒▓█▓▒░░▒▓██████▓▒░░▒▓███████▓▒░░▒▓██▓▒░▒▓█▓▒░"
- ]
- # Define the ASCII "sign"
- ascii_sign = [
- " │ │ ",
- " │ │ ",
- " │ │ ",
- " │ │ ",
- " ┌───|───┬───────────────────────────────────────┬───|───┐ ",
- " │██\\~/@◄┘███████████████████████████████████████└►@\\~/██│ ",
- " │█ █│ ",
- " │█ █│ ",
- " │█ █│ ",
- " │█ █│ ",
- " │█ █│ ",
- " │█ █│ ",
- " │█ █│ ",
- " │███████████████████████████████████████████████████████│ ",
- " └───────────────────────────────────────────────────────┘ ",
- " "
- ]
- # Define the additional lines
- additional_line2 = "Enter URL:"
- # Get the screen dimensions
- height, width = stdscr.getmaxyx()
- # Calculate starting positions to center the text horizontally
- start_x_sign = (width - max(len(line) for line in ascii_sign)) // 2
- start_x_additional2 = (width - len(additional_line2) - 1) // 2
- start_x_pattern = (len(ascii_sign[0]) - max(len(line) for line in pattern)) // 2
- # Print the ASCII "sign" at the top center of the screen
- for i, line in enumerate(ascii_sign):
- stdscr.addstr(i, start_x_sign, line)
- # Print the title pattern within the "sign"
- for i, line in enumerate(pattern):
- stdscr.addstr(7 + i, start_x_sign + start_x_pattern, line)
- # Print the additional lines below the ASCII "sign"
- stdscr.addstr(len(ascii_sign), start_x_additional2, additional_line2)
- stdscr.refresh()
- # Capture URL input
- stdscr.addstr(len(ascii_sign), start_x_additional2 + len(additional_line2) + 1, "") # Move the cursor after "Enter URL:"
- curses.echo() # Enable echoing of typed characters
- url = stdscr.getstr(len(ascii_sign), start_x_additional2 + len(additional_line2) + 1).decode('utf-8') # Get user input and decode from bytes to string
- # Open the URL in the default web browser
- webbrowser.open(url)
- # Initialize the curses application
- curses.wrapper(main)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement