XenoNote Python GUI

👤 Sharing: AI
import tkinter as tk
from tkinter import ttk
from tkinter import scrolledtext
import json
import os
import hashlib

class XenoNoteApp:
    def __init__(self, master):
        self.master = master
        master.title("XenoNote: The Secure and Organized Note-Taking App")

        self.style = ttk.Style(master)
        self.style.theme_use('clam') # 'clam', 'alt', 'default', 'classic', 'vista', 'xp'

        # Notebook (Tabs)
        self.notebook = ttk.Notebook(master)
        self.notebook.pack(fill='both', expand=True, padx=10, pady=10)

        self.notes = {}
        self.load_notes()

        # Initial Tab (Example Note)
        self.add_new_note("Welcome")

        # Buttons
        button_frame = tk.Frame(master)
        button_frame.pack(pady=5)

        self.add_button = ttk.Button(button_frame, text="New Note", command=self.add_new_note)
        self.add_button.pack(side=tk.LEFT, padx=5)

        self.delete_button = ttk.Button(button_frame, text="Delete Note", command=self.delete_note)
        self.delete_button.pack(side=tk.LEFT, padx=5)

        self.save_button = ttk.Button(button_frame, text="Save Notes", command=self.save_notes)
        self.save_button.pack(side=tk.LEFT, padx=5)

        self.details_button = ttk.Button(button_frame, text="Details", command=self.show_details)
        self.details_button.pack(side=tk.LEFT, padx=5)


    def add_new_note(self, title="New Note"):
        tab = ttk.Frame(self.notebook)
        self.notebook.add(tab, text=title)
        self.notebook.select(tab)

        text_area = scrolledtext.ScrolledText(tab, wrap=tk.WORD)
        text_area.pack(fill='both', expand=True, padx=5, pady=5)

        self.notes[tab] = {"title": title, "text_area": text_area}

    def delete_note(self):
        selected_tab = self.notebook.select()
        if not selected_tab:
            return
        tab = self.master.nametowidget(selected_tab)
        title = self.notes[tab]['title']
        del self.notes[tab]
        self.notebook.forget(tab)

    def save_notes(self):
        data = {}
        for tab, note_data in self.notes.items():
            title = note_data['title']
            text = note_data['text_area'].get("1.0", tk.END)
            data[title] = text

        try:
            with open("xenonote_data.json", "w") as f:
                json.dump(data, f, indent=4)
            print("Notes saved successfully!")
        except Exception as e:
            print(f"Error saving notes: {e}")

    def load_notes(self):
        try:
            with open("xenonote_data.json", "r") as f:
                data = json.load(f)
                for title, text in data.items():
                    self.add_new_note(title)
                    selected_tab = self.notebook.select()
                    tab = self.master.nametowidget(selected_tab)
                    self.notes[tab]['text_area'].delete("1.0", tk.END)
                    self.notes[tab]['text_area'].insert("1.0", text)

        except FileNotFoundError:
            print("No existing notes found.")
        except Exception as e:
            print(f"Error loading notes: {e}")

    def show_details(self):
         details_window = tk.Toplevel(self.master)
         details_window.title("XenoNote Details")

         details_text = tk.Text(details_window, wrap=tk.WORD, height=20, width=60)
         details_text.pack(padx=10, pady=10)
         details_text.insert(tk.END, self.get_details())
         details_text.config(state=tk.DISABLED)

    def get_details(self):
        return """XenoNote: The Secure and Organized Note-Taking App

XenoNote is a versatile note-taking application designed for secure and organized information management.  It features:

*   Tabbed Interface: Organize notes into multiple tabs for easy navigation.
*   Rich Text Editing: Use the built-in text editor to format and structure your notes.
*   Secure Storage: Notes are saved locally in an encrypted format for enhanced security. (Note: This version doesn't include encryption. Encryption would involve libraries like 'cryptography' for real encryption.  This version saves to JSON.)
*   Automatic Saving:  (Currently just a save button) Save your notes with a single click. Future versions can include automatic saving.
*   User-Friendly Interface: A clean and intuitive design for a seamless note-taking experience.

Future Enhancements:

*   Encryption: Full encryption of notes for maximum security.
*   Cloud Sync:  Synchronize notes across multiple devices.
*   Advanced Formatting:  More text formatting options (bold, italics, lists, etc.).
*   Search Functionality: Quickly find notes based on keywords.
*   Tagging: Organize notes using tags.
*   Reminders: Set reminders for important notes.
*   Attachment Support:  Attach files to notes.

This version uses Tkinter and ttk for the GUI and JSON for data storage. It's designed to be easily extensible and customizable.

This app stores your notes as a JSON file named 'xenonote_data.json' in the same directory as the script.
"""


root = tk.Tk()
app = XenoNoteApp(root)
root.mainloop()
👁️ Viewed: 7

Comments