Advertisement
EdmundC

homepage

Jul 15th, 2024 (edited)
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.82 KB | None | 0 0
  1. import os
  2. import shutil
  3. import time
  4.  
  5. def clear_screen():
  6.     os.system('clear')
  7.  
  8. def display_welcome_message():
  9.     # Get the terminal window size
  10.     columns, rows = shutil.get_terminal_size()
  11.  
  12.     # The message to display
  13.     message = "Welcome to Edmund's Homepage!"
  14.  
  15.     # Calculate the position to center the message
  16.     centered_message = message.center(columns)
  17.  
  18.     # Print the message at the top center
  19.     print(f"\033[1;1H{centered_message}")
  20.  
  21. def display_ascii_art():
  22.     ascii_art = """
  23.      /─────────────────────────────────────────┐      
  24.     /│  -PROJECTS-PROJECTS-PROJECTS-PROJECTS-  │      
  25.    │ ├─────────────────────────────────────────┤      
  26.    │ │               SkyDefenders              │      
  27.    │ │                                         │      
  28.    │ │                                         │      
  29.    │ │                                         │      
  30.    │ │                                         │      
  31.    │ │                                         │      
  32.    │ │                                         │      
  33.    │ │                                         │      
  34.    │ │                                         │      
  35.    │ │                                         │      
  36.    │ │                                         │      
  37.    │ │                                         │      
  38.    │ │                                         │      
  39.    │ │                                         │      
  40.    │ │                                         │      
  41.    │ │                                         │      
  42.    │ │                                         │      
  43.    │ │                                         │      
  44.    │ │                                         │      
  45.    │ /─────────────────────────────────────────/      
  46.    │/_________________________________________/      
  47.    """
  48.     print(ascii_art)
  49.  
  50. def run_skydef():
  51.     os.system('python3 airplane_shooter.py')
  52.     # Wait a moment to allow the user to see the completion message
  53.     time.sleep(2)
  54.  
  55. def main():
  56.     while True:
  57.         clear_screen()
  58.         display_welcome_message()
  59.         display_ascii_art()
  60.        
  61.         choice = input("Select an option (type 'SkyDef' to run it): ").strip()
  62.        
  63.         if choice.lower() == 'skydef':
  64.             run_skydef()
  65.         else:
  66.             print("Invalid option. Returning to homepage...")
  67.             time.sleep(2)
  68.  
  69. if __name__ == "__main__":
  70.     main()
  71.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement