Skip to main content

Featured

Solving Economic Crisis Without Work-From-Home: A Systems Approach to Resource Prioritization

  1. The Economic Problem: Diagnosing the Crisis Type 1.1 Crisis Typology and Sector Dynamics Currency crises typically emerge from one or more of these imbalances: Current account deficits — Imports exceed exports; forex drains to cover the gap Capital account withdrawal — Foreign investors exit; hot money leaves Inflation-driven overvaluation — Real exchange rate strengthens despite nominal devaluation Debt servicing burden — External debt payouts drain reserves faster than exports can cover The empirical record shows that currency crises are sectoral crises —not aggregate demand crises. When Argentina devalued 75% in 2001, the economy contracted 10.9%, but manufacturing capacity utilization recovered within 18 months because input costs fell (Hausmann & Velasco, 2002). When Vietnam reformed in 1986, manufacturing capacity expansion drove recovery before demand-side effects materialized. Critical insight: Resource reallocation works when the constraint is supply-sid...

Python Project Notepad with features

 import tkinter as tk

from tkinter import messagebox, ttk
from plyer import notification
import json
import pywhatkit as kit
import time
from datetime import datetime

# File paths for storing notes and contacts
NOTES_FILE = "notes.json"
CONTACTS_FILE = "contacts.json"

# Function to save a note
def save_note():
    note = note_text.get("1.0", tk.END).strip()
    if not note:
        messagebox.showwarning("Empty Note", "Note is empty. Please write something.")
        return
    with open(NOTES_FILE, 'w') as file:
        json.dump(note, file)
    messagebox.showinfo("Note Saved", "Your note has been saved.")

# Function to load the note
def load_note():
    try:
        with open(NOTES_FILE, 'r') as file:
            note = json.load(file)
            note_text.delete("1.0", tk.END)
            note_text.insert(tk.END, note)
    except FileNotFoundError:
        messagebox.showwarning("No Note Found", "No note found. Please write a note first.")

# Function to set a reminder
def set_reminder():
    reminder_text = reminder_entry.get().strip()
    reminder_time = reminder_time_entry.get().strip()
    if not reminder_text or not reminder_time:
        messagebox.showwarning("Incomplete Information", "Please provide reminder text and time.")
        return
   
    try:
        reminder_time = datetime.strptime(reminder_time, "%d-%m-%Y %H:%M")
    except ValueError:
        messagebox.showwarning("Invalid Time Format", "Please provide the time in DD-MM-YYYY HH:MM format.")
        return

    delay = (reminder_time - datetime.now()).total_seconds()
   
    if delay <= 0:
        messagebox.showwarning("Invalid Time", "Please set a future time for the reminder.")
        return
   
    root.after(int(delay * 1000), lambda: show_reminder(reminder_text))
    messagebox.showinfo("Reminder Set", f"Reminder set for {reminder_time}")

# Function to show the reminder
def show_reminder(reminder_text):
    notification.notify(
        title="Reminder",
        message=reminder_text,
        timeout=10
    )
    messagebox.showinfo("Reminder", reminder_text)

# Function to add a contact
def add_contact():
    name = contact_name_entry.get().strip()
    number = contact_number_entry.get().strip()
    if not name or not number:
        messagebox.showwarning("Incomplete Information", "Please provide both name and number.")
        return
   
    contact = {name: number}
    try:
        with open(CONTACTS_FILE, 'r') as file:
            contacts = json.load(file)
    except FileNotFoundError:
        contacts = {}
   
    contacts.update(contact)
   
    with open(CONTACTS_FILE, 'w') as file:
        json.dump(contacts, file)
   
    update_contact_dropdowns()
    messagebox.showinfo("Contact Added", f"Contact {name} added successfully!")

# Function to update the dropdown menus with contact names
def update_contact_dropdowns():
    try:
        with open(CONTACTS_FILE, 'r') as file:
            contacts = json.load(file)
    except FileNotFoundError:
        contacts = {}

    contact_names = list(contacts.keys())
    contact_dropdown['values'] = contact_names
    whatsapp_contact_dropdown['values'] = contact_names

# Function to send a WhatsApp message
def send_whatsapp_message():
    contact_name = whatsapp_contact_dropdown.get()
    message = whatsapp_message_entry.get("1.0", tk.END).strip()
    send_time = whatsapp_time_entry.get().strip()
   
    if not contact_name or not message or not send_time:
        messagebox.showwarning("Incomplete Information", "Please provide all the necessary information.")
        return
   
    try:
        with open(CONTACTS_FILE, 'r') as file:
            contacts = json.load(file)
    except FileNotFoundError:
        messagebox.showwarning("No Contacts", "No contacts found. Please add contacts first.")
        return
   
    if contact_name not in contacts:
        messagebox.showwarning("Contact Not Found", f"No contact found with the name {contact_name}.")
        return
   
    try:
        send_time = datetime.strptime(send_time, "%d-%m-%Y %H:%M")
    except ValueError:
        messagebox.showwarning("Invalid Time Format", "Please provide the time in DD-MM-YYYY HH:MM format.")
        return

    delay = (send_time - datetime.now()).total_seconds()
   
    if delay <= 0:
        messagebox.showwarning("Invalid Time", "Please set a future time for sending the message.")
        return
   
    number = contacts[contact_name]
   
    root.after(int(delay * 1000), lambda: kit.sendwhatmsg_instantly(f"+{number}", message))
    messagebox.showinfo("Message Scheduled", f"Message to {contact_name} scheduled for {send_time}")

# Tkinter setup
root = tk.Tk()
root.title("Multi-Functional Notepad")

# Note-taking section
note_text = tk.Text(root, height=10, width=50)
note_text.pack()

save_button = tk.Button(root, text="Save Note", command=save_note)
save_button.pack()

load_button = tk.Button(root, text="Load Note", command=load_note)
load_button.pack()

# Reminder section
tk.Label(root, text="Reminder Text:").pack()
reminder_entry = tk.Entry(root, width=50)
reminder_entry.pack()

tk.Label(root, text="Reminder Time (DD-MM-YYYY HH:MM):").pack()
reminder_time_entry = tk.Entry(root, width=50)
reminder_time_entry.pack()

reminder_button = tk.Button(root, text="Set Reminder", command=set_reminder)
reminder_button.pack()

# Contact section
tk.Label(root, text="Contact Name:").pack()
contact_name_entry = tk.Entry(root, width=50)
contact_name_entry.pack()

tk.Label(root, text="Contact Number:").pack()
contact_number_entry = tk.Entry(root, width=50)
contact_number_entry.pack()

add_contact_button = tk.Button(root, text="Add Contact", command=add_contact)
add_contact_button.pack()

tk.Label(root, text="View Contacts:").pack()
contact_dropdown = ttk.Combobox(root, width=47)
contact_dropdown.pack()

# WhatsApp section
tk.Label(root, text="WhatsApp Contact:").pack()
whatsapp_contact_dropdown = ttk.Combobox(root, width=47)
whatsapp_contact_dropdown.pack()

tk.Label(root, text="Message:").pack()
whatsapp_message_entry = tk.Text(root, height=5, width=50)
whatsapp_message_entry.pack()

tk.Label(root, text="Send Time (DD-MM-YYYY HH:MM):").pack()
whatsapp_time_entry = tk.Entry(root, width=50)
whatsapp_time_entry.pack()

send_whatsapp_button = tk.Button(root, text="Send WhatsApp Message", command=send_whatsapp_message)
send_whatsapp_button.pack()

# Initialize contact dropdown menus
update_contact_dropdowns()

root.mainloop()

Comments

Popular Posts