Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # UMenu.py
- # Perpustakaan----------------
- import os
- from subprocess import call
- import shutil
- #-----------------------------
- # Function to print colored text---------------
- def print_color(text, color):
- if color == 'red':
- print("\033[91m" + text + "\033[00m")
- elif color == 'green':
- print("\033[92m" + text + "\033[00m")
- elif color == 'yellow':
- print("\033[93m" + text + "\033[00m")
- elif color == 'blue':
- print("\033[94m" + text + "\033[00m")
- else:
- print(text)
- #---------------------------------------------
- # Define the logo-----------------------------------------------------------------------
- logo = (
- "\033[34m ██╗░░░██╗████████╗░██████╗░░░░░░░█████╗░███╗░░██╗░██████╗███████╗ \n"
- "\033[34m ██║░░░██║╚══██╔══╝██╔════╝░░░░░░██╔══██╗████╗░██║██╔════╝╚════██║ \n"
- "\033[34m ██║░░░██║░░░██║░░░╚█████╗░█████╗███████║██╔██╗██║╚█████╗░░░░░██╔╝ \n"
- "\033[34m ██║░░░██║░░░██║░░░░╚═══██╗╚════╝██╔══██║██║╚████║░╚═══██╗░░░██╔╝░ \n"
- "\033[34m ██║░░░██║░░░██║░░░░╚═══██╗╚════╝██╔══██║██║╚████║░╚═══██╗░░░██╔╝░ \n"
- "\033[34m ╚██████╔╝░░░██║░░░██████╔╝░░░░░░██║░░██║██║░╚███║██████╔╝░░██╔╝░░ \n"
- "\033[34m ░╚═════╝░░░░╚═╝░░░╚═════╝░░░░░░░╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░░░╚═╝░░░ \n\n"
- "\033 Tugas UTS Algoritma 2\n\n"
- "\033 [91m 1. Afrizal Wahyu Adi Putra\t 11230070\n"
- "\033 2. Nadia Zahira Sofa\t\t 11230056 \n"
- "\033 3. Syifa Susila Pratami\t 11230068 \n"
- "\033[0m"
- )
- #---------------------------------------------------------------------------------------
- # Clear screen------------------------------------
- os.system('cls' if os.name == 'nt' else 'clear')
- #-------------------------------------------------
- # Print the logo---------
- print(logo)
- #------------------------
- #Menampilkan Menu----------------------------
- def show_menu():
- print("=== Menu Program ===")
- print("| 1. Program 1 |")
- print("| 2. Program 2 |")
- print("| 3. Program 3 |")
- print("| 4. Program 4 |")
- print("| 5. Program 5 |")
- print("| 6 Program 6 |")
- print("| 7. Program 7 |")
- print("| 8. Program 8 |")
- print("| 9. Program 9 |")
- print("| 10. Program 10 |")
- print("====================")
- #--------------------------------------------
- #--------------------------------------------------------------------------------------------
- def run_program(program_number):
- program_path = os.path.join(os.path.dirname(__file__), f"UProblem.py {program_number}")
- os.system(f"python {program_path}")
- if __name__ == "__main__":
- show_menu()
- choice = int(input("Pilih program (1-10): "))
- if 1 <= choice <= 10:
- run_program(choice)
- else:
- print("Pilihan tidak valid.")
- #--------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement