diff --git a/.gitignore b/.gitignore index eb674d3e..2d8555bf 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ /.vs /Tic_Tac_Toe/tic_tac_toe -OOP.py /.vscode +Converter/converter.py +Converter/converter_gui.py diff --git a/Converter/How to use unit converter GUI.gif b/Converter/How to use unit converter GUI.gif new file mode 100644 index 00000000..dc0eb75a Binary files /dev/null and b/Converter/How to use unit converter GUI.gif differ diff --git a/Converter/README.md b/Converter/README.md index 7181917e..056de66c 100644 --- a/Converter/README.md +++ b/Converter/README.md @@ -6,24 +6,58 @@

+ ## 🛠️ Description -A simple converter app built in python. +A simple converter app built in Python. Now supports both command-line and graphical user interface (GUI) modes with PyQt5 or Tkinter. ## ⚙️ Languages or Frameworks Used -You only need Python to run this script. You can visit here to download Python. +- Python 3 +- PyQt5 (for modern GUI) +- Tkinter (for classic GUI) ## 🌟 How to run -Running the script is really simple! Just open a terminal in the folder where your script is located and run the following command: +Open a terminal in the folder where your script is located and run one of the following commands: +**For the classic command-line converter:** ```sh python converter.py ``` +**For the GUI version (choose PyQt5 or Tkinter):** +```sh +python converter_gui.py +``` +You will be prompted to select which GUI you prefer (`pyqt5` or `tkinter`). + +- If you choose `pyqt5`, make sure you have PyQt5 installed: + ```sh + pip install pyqt5 + ``` +- If you choose `tkinter`, it is included with most Python installations by default. + ## 📺 Demo

- + ## 🤖 Author [Alen Senson](https://github.com/AlenSenson) + +--- + +### ✨ Features +- Convert between units of Length, Area, Volume, Mass, and Time +- Easy-to-use GUI (PyQt5 or Tkinter) +- Command-line support +- Help and symbols for all units + +### 📝 Usage (GUI) +1. Select a unit category (e.g. Length, Area, Volume, Mass, Time) +2. Select the starting unit (From unit) +3. Enter the value you want to convert +4. Select or type one or more target units (To unit(s)), separated by commas if more than one +5. Click "Convert" to see the results +6. For unit symbols, click "Symbols" + +--- diff --git a/Converter/__pycache__/converter_values.cpython-313.pyc b/Converter/__pycache__/converter_values.cpython-313.pyc new file mode 100644 index 00000000..fbef9e82 Binary files /dev/null and b/Converter/__pycache__/converter_values.cpython-313.pyc differ diff --git a/Converter/converter_gui.py b/Converter/converter_gui.py new file mode 100644 index 00000000..3505ecd3 --- /dev/null +++ b/Converter/converter_gui.py @@ -0,0 +1,264 @@ +import sys +print("Which GUI do you prefer? (pyqt5/tkinter)") +gui_choice = input("Choice: ").strip().lower() + +if gui_choice == "pyqt5": + from PyQt5.QtWidgets import ( + QApplication, QWidget, QLabel, QComboBox, QLineEdit, QPushButton, QTextEdit, QVBoxLayout, QHBoxLayout, QMessageBox + ) + from converter_values import L, A, V, M, T, options + + # Νέο help string για GUI + gui_help = '''\ +Unit Converter Instructions: + +1. Select a unit category (e.g. Length, Area, Volume, Mass, Time). +2. Select the starting unit (From unit). +3. Enter the value you want to convert. +4. Select or type one or more target units (To unit(s)), separated by commas if more than one. +5. Click "Convert" to see the results. + +To see the unit symbols, click "Symbols". +''' + + CATEGORY_MAP = { + 'Length': L, + 'Area': A, + 'Volume': V, + 'Mass': M, + 'Time': T + } + + class ConverterGUI(QWidget): + def __init__(self): + super().__init__() + self.setWindowTitle('Unit Converter') + self.init_ui() + + def init_ui(self): + layout = QVBoxLayout() + + # Category selection + self.category_label = QLabel('Category:') + self.category_combo = QComboBox() + self.category_combo.addItems(CATEGORY_MAP.keys()) + self.category_combo.currentTextChanged.connect(self.update_units) + + # From unit + self.from_label = QLabel('From unit:') + self.from_combo = QComboBox() + + # Value + self.value_label = QLabel('Value:') + self.value_edit = QLineEdit() + self.value_edit.setPlaceholderText('Enter value') + + # To unit(s) + self.to_label = QLabel('To unit(s):') + self.to_combo = QComboBox() + self.to_combo.setEditable(True) + self.to_combo.setInsertPolicy(QComboBox.NoInsert) + + # Convert button + self.convert_btn = QPushButton('Convert') + self.convert_btn.clicked.connect(self.convert) + + # Result + self.result_text = QTextEdit() + self.result_text.setReadOnly(True) + + # Help and Symbols + self.help_btn = QPushButton('Help') + self.help_btn.clicked.connect(self.show_help) + self.symbols_btn = QPushButton('Symbols') + self.symbols_btn.clicked.connect(self.show_symbols) + + # Layouts + row1 = QHBoxLayout() + row1.addWidget(self.category_label) + row1.addWidget(self.category_combo) + row2 = QHBoxLayout() + row2.addWidget(self.from_label) + row2.addWidget(self.from_combo) + row3 = QHBoxLayout() + row3.addWidget(self.value_label) + row3.addWidget(self.value_edit) + row4 = QHBoxLayout() + row4.addWidget(self.to_label) + row4.addWidget(self.to_combo) + row5 = QHBoxLayout() + row5.addWidget(self.convert_btn) + row5.addWidget(self.help_btn) + row5.addWidget(self.symbols_btn) + + layout.addLayout(row1) + layout.addLayout(row2) + layout.addLayout(row3) + layout.addLayout(row4) + layout.addLayout(row5) + layout.addWidget(self.result_text) + + self.setLayout(layout) + self.update_units(self.category_combo.currentText()) + + def update_units(self, category): + units = list(CATEGORY_MAP[category].keys()) + self.from_combo.clear() + self.from_combo.addItems(units) + self.to_combo.clear() + self.to_combo.addItems(units) + + def convert(self): + category = self.category_combo.currentText() + from_unit = self.from_combo.currentText() + value_str = self.value_edit.text() + to_units = self.to_combo.currentText().split(',') + try: + value = float(value_str) + except ValueError: + QMessageBox.warning(self, 'Error', 'Invalid value!') + return + table = CATEGORY_MAP[category] + if from_unit not in table: + QMessageBox.warning(self, 'Error', 'Invalid from unit!') + return + results = [] + for to_unit in to_units: + to_unit = to_unit.strip() + if to_unit not in table: + results.append(f"{to_unit}: Invalid unit") + continue + try: + result = round(value * table[to_unit] / table[from_unit], 6) + results.append(f"{to_unit}: {result}") + except Exception as e: + results.append(f"{to_unit}: Error") + self.result_text.setText('\n'.join(results)) + + def show_help(self): + QMessageBox.information(self, 'Help', gui_help) + + def show_symbols(self): + QMessageBox.information(self, 'Symbols', options['symbols']) + + if __name__ == '__main__': + app = QApplication(sys.argv) + window = ConverterGUI() + window.show() + sys.exit(app.exec_()) + +elif gui_choice == "tkinter": + import tkinter as tk + from tkinter import ttk, messagebox + from converter_values import L, A, V, M, T, options + + gui_help = '''\ +Unit Converter Instructions: + +1. Select a unit category (e.g. Length, Area, Volume, Mass, Time). +2. Select the starting unit (From unit). +3. Enter the value you want to convert. +4. Select or type one or more target units (To unit(s)), separated by commas if more than one. +5. Click "Convert" to see the results. + +To see the unit symbols, click "Symbols". +''' + + CATEGORY_MAP = { + 'Length': L, + 'Area': A, + 'Volume': V, + 'Mass': M, + 'Time': T + } + + class ConverterTk(tk.Tk): + def __init__(self): + super().__init__() + self.title('Unit Converter') + self.geometry('400x400') + self.create_widgets() + + def create_widgets(self): + # Category + tk.Label(self, text='Category:').pack() + self.category = ttk.Combobox(self, values=list(CATEGORY_MAP.keys()), state='readonly') + self.category.pack() + self.category.bind('<>', self.update_units) + self.category.current(0) + + # From unit + tk.Label(self, text='From unit:').pack() + self.from_unit = ttk.Combobox(self, state='readonly') + self.from_unit.pack() + + # Value + tk.Label(self, text='Value:').pack() + self.value_entry = tk.Entry(self) + self.value_entry.pack() + + # To unit(s) - editable ComboBox + tk.Label(self, text='To unit(s) (comma separated):').pack() + self.to_units = ttk.Combobox(self) + self.to_units.pack() + + # Convert button + tk.Button(self, text='Convert', command=self.convert).pack(pady=5) + # Help and Symbols + tk.Button(self, text='Help', command=self.show_help).pack(side='left', padx=10, pady=5) + tk.Button(self, text='Symbols', command=self.show_symbols).pack(side='right', padx=10, pady=5) + + # Result + self.result = tk.Text(self, height=10, width=40) + self.result.pack(pady=10) + + self.update_units() + + def update_units(self, event=None): + cat = self.category.get() if hasattr(self, 'category') else list(CATEGORY_MAP.keys())[0] + units = list(CATEGORY_MAP[cat].keys()) + self.from_unit['values'] = units + self.from_unit.current(0) + self.to_units['values'] = units + if units: + self.to_units.set(units[0]) + + def convert(self): + cat = self.category.get() + from_unit = self.from_unit.get() + value_str = self.value_entry.get() + to_units = self.to_units.get().split(',') + try: + value = float(value_str) + except ValueError: + messagebox.showwarning('Error', 'Invalid value!') + return + table = CATEGORY_MAP[cat] + if from_unit not in table: + messagebox.showwarning('Error', 'Invalid from unit!') + return + results = [] + for to_unit in to_units: + to_unit = to_unit.strip() + if to_unit not in table: + results.append(f"{to_unit}: Invalid unit") + continue + try: + result = round(value * table[to_unit] / table[from_unit], 6) + results.append(f"{to_unit}: {result}") + except Exception: + results.append(f"{to_unit}: Error") + self.result.delete('1.0', tk.END) + self.result.insert(tk.END, '\n'.join(results)) + + def show_help(self): + messagebox.showinfo('Help', gui_help) + + def show_symbols(self): + messagebox.showinfo('Symbols', options['symbols']) + + if __name__ == '__main__': + app = ConverterTk() + app.mainloop() +else: + print("Invalid choice. Please run the program again and select 'pyqt5' or 'tkinter'.") diff --git a/NASA_Image_Extraction/Astro_Images/2022-11-25_NGC 6744: Extragalactic Close-Up.mp3 b/NASA_Image_Extraction/Astro_Images/2022-11-25_NGC 6744: Extragalactic Close-Up.mp3 deleted file mode 100644 index f5611fcf..00000000 Binary files a/NASA_Image_Extraction/Astro_Images/2022-11-25_NGC 6744: Extragalactic Close-Up.mp3 and /dev/null differ diff --git a/Password Generator with GUI/README.md b/Password Generator with GUI/README.md new file mode 100644 index 00000000..3e747df4 --- /dev/null +++ b/Password Generator with GUI/README.md @@ -0,0 +1,70 @@ +# Password Generator + +This is a simple yet versatile password generator written in Python. It allows users to generate random passwords that include: + +- Special characters (`+`, `-`, `*`, `/`, `@`, `#`, etc.) +- English letters (both lowercase and uppercase) +- Greek letters (both lowercase and uppercase) + +The program provides two modes of use: +- **Command-line interface (CLI)** +- **Graphical User Interface (GUI) using Tkinter** + +## Features + +- User-defined password length. +- Random character selection from multiple sets. +- Supports both English and Greek letters. +- Option to use a GUI or stay in the terminal. + +## How to Run + +### Requirements +- Python 3.x +- Tkinter (usually included with standard Python distributions) + +### Run the Program + +```bash +python password\ generator.py +``` + +You will be asked whether you want to use the GUI: + +``` +Do you want to use the GUI version? (yes/no): +``` + +### If you choose `yes`: +- A GUI window will appear. +- Enter the desired password length. +- Click "Generate Password" to create a new password. + +### If you choose `no`: +- The program runs in the terminal. +- You’ll be prompted to enter the desired length. +- A password will be printed directly to the console. + +## Notes + +- The GUI version uses `tkinter.messagebox` for error handling. +- The terminal version runs in a loop and generates a new password every time you provide a new length. +- The output password may include Greek characters, so make sure your application or website supports Unicode characters if you're using these passwords. + +## Example Output + +```text +Welcome to the Password Generator! +This program generates a random password using special characters, English letters, and Greek letters. +You can choose the length of the password, and it will include a mix of characters from these sets. +Let's get started! +Do you want to use the GUI version? (yes/no): no +How many characters do you want your password to have? 12 +Your password is: αrΔh8@XωK$Π +You can copy and save it somewhere +I hope you liked my program! +``` + +## License + +This project is released for educational purposes. You are free to use, modify, and distribute it. diff --git a/Password Generator with GUI/password generator.py b/Password Generator with GUI/password generator.py new file mode 100644 index 00000000..3d7a26ae --- /dev/null +++ b/Password Generator with GUI/password generator.py @@ -0,0 +1,95 @@ +import random +import tkinter as tk +from tkinter import messagebox + +# List of special characters to use in the password +special_characters = ['+', '-', '*', '/','@','#','$','%','^','&','*','(',')'] + +# List of English alphabet letters (lowercase and uppercase) +letters = [ + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', + 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', + 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' +] + +# List of Greek alphabet letters (lowercase and uppercase) +greek_letters = [ + 'α', 'β', 'γ', 'δ', 'ε', 'ζ', 'η', 'θ', 'ι', 'κ', 'λ', 'μ', 'ν', 'ξ', 'ο', 'π', 'ρ', 'σ', 'τ', 'υ', 'φ', 'χ', 'ψ', 'ω', + 'Α', 'Β', 'Γ', 'Δ', 'Ε', 'Ζ', 'Η', 'Θ', 'Ι', 'Κ', 'Λ', 'Μ', 'Ν', 'Ξ', 'Ο', 'Π', 'Ρ', 'Σ', 'Τ', 'Υ', 'Φ', 'Χ', 'Ψ', 'Ω' +] + +# Welcome message +print("Welcome to the Password Generator!") +print("This program generates a random password using special characters, English letters, and Greek letters.") +print("You can choose the length of the password, and it will include a mix of characters from these sets.") +print("Let's get started!") + +gui= input("Do you want to use the GUI version? (yes/no): ").strip().lower() +if gui == 'yes': + # --- GUI Implementation with tkinter --- + def generate_password(): + try: + length = int(length_entry.get()) + if length <= 0: + messagebox.showerror("Error", "Please enter a positive number.") + return + except ValueError: + messagebox.showerror("Error", "Please enter a valid number.") + return + + all_lists = [special_characters, letters, greek_letters] + output_password = "" + for i in range(length): + character_list = random.choice(all_lists) + symbol = random.choice(character_list) + output_password += symbol + password_var.set(output_password) + + # Create main window + root = tk.Tk() + root.title("Password Generator") + + # Label for instructions + tk.Label(root, text="Enter password length:").pack(pady=5) + + # Entry for password length + length_entry = tk.Entry(root) + length_entry.pack(pady=5) + + # Button to generate password + tk.Button(root, text="Generate Password", command=generate_password).pack(pady=5) + + # Variable to hold the generated password + password_var = tk.StringVar() + + # Entry widget to show the generated password (so you can copy it) + password_entry = tk.Entry(root, textvariable=password_var, font=("Consolas", 14), fg="blue", width=30) + password_entry.pack(pady=10) + + # Start the GUI event loop + root.mainloop() + +elif gui == 'no': + # Combine all character lists into one list for easier selection + all_lists = [special_characters, letters, greek_letters] + while True: + # Ask the user for the desired password length + password_length = int(input("How many characters do you want your password to have? ")) + + # Initialize the output password as an empty string + output_password = "" + + # Loop to generate each character of the password + for i in range(0, password_length): + # Randomly select one of the character lists (special, English, or Greek) + character_list = random.choice(all_lists) + # Randomly select a symbol from the chosen list + symbol = random.choice(character_list) + # Add the selected symbol to the password + output_password = output_password + symbol + + # Print the generated password + print("Your password is:", output_password) + print("You can copy and save it somewhere") + print("I hope you liked my program!") \ No newline at end of file