Advertisement
EdmundC

Untitled

Jul 26th, 2024 (edited)
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.38 KB | None | 0 0
  1. import curses
  2. import webbrowser
  3.  
  4. def main(stdscr):
  5.     curses.curs_set(0)  # Hide the cursor
  6.     stdscr.clear()      # Clear the screen
  7.  
  8.     # Define the pattern
  9.     pattern = [
  10.         "░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓███████▓▒░       ░▒▓█▓▒░",
  11.         "░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░   ░▒▓████▓▒░",
  12.         "░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░      ░▒▓█▓▒░",
  13.         "░▒▓████████▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓███████▓▒░       ░▒▓█▓▒░",
  14.         "░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░      ░▒▓█▓▒░",
  15.         "░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓██▓▒░▒▓█▓▒░",
  16.         "░▒▓█▓▒░░▒▓█▓▒░░▒▓██████▓▒░░▒▓███████▓▒░░▒▓██▓▒░▒▓█▓▒░"
  17.     ]
  18.  
  19.     # Define the ASCII "sign"
  20.     ascii_sign = [
  21.         "     │                                               │     ",
  22.         "     │                                               │     ",
  23.         "     │                                               │     ",
  24.         "     │                                               │     ",
  25.         " ┌───|───┬───────────────────────────────────────┬───|───┐ ",
  26.         " │██\\~/@◄┘███████████████████████████████████████└►@\\~/██│ ",
  27.         " │█                                                     █│ ",
  28.         " │█                                                     █│ ",
  29.         " │█                                                     █│ ",
  30.         " │█                                                     █│ ",
  31.         " │█                                                     █│ ",
  32.         " │█                                                     █│ ",
  33.         " │█                                                     █│ ",
  34.         " │███████████████████████████████████████████████████████│ ",
  35.         " └───────────────────────────────────────────────────────┘ ",
  36.         "                                                            "
  37.     ]
  38.  
  39.     # Define the additional lines
  40.     additional_line2 = "Enter URL:"
  41.  
  42.     # Get the screen dimensions
  43.     height, width = stdscr.getmaxyx()
  44.  
  45.     # Calculate starting positions to center the text horizontally
  46.     start_x_sign = (width - max(len(line) for line in ascii_sign)) // 2
  47.     start_x_additional2 = (width - len(additional_line2) - 1) // 2
  48.     start_x_pattern = (len(ascii_sign[0]) - max(len(line) for line in pattern)) // 2
  49.  
  50.     # Print the ASCII "sign" at the top center of the screen
  51.     for i, line in enumerate(ascii_sign):
  52.         stdscr.addstr(i, start_x_sign, line)
  53.  
  54.     # Print the title pattern within the "sign"
  55.     for i, line in enumerate(pattern):
  56.         stdscr.addstr(7 + i, start_x_sign + start_x_pattern, line)
  57.  
  58.     # Print the additional lines below the ASCII "sign"
  59.     stdscr.addstr(len(ascii_sign), start_x_additional2, additional_line2)
  60.  
  61.     stdscr.refresh()
  62.  
  63.     # Capture URL input
  64.     stdscr.addstr(len(ascii_sign), start_x_additional2 + len(additional_line2) + 1, "")  # Move the cursor after "Enter URL:"
  65.     curses.echo()  # Enable echoing of typed characters
  66.     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
  67.  
  68.     # Open the URL in the default web browser
  69.     webbrowser.open(url)
  70.  
  71. # Initialize the curses application
  72. curses.wrapper(main)
  73.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement