diff --git a/budget.py b/budget.py
index b7fca74..5da6299 100644
--- a/budget.py
+++ b/budget.py
@@ -2,6 +2,8 @@ from http.server import BaseHTTPRequestHandler, HTTPServer
from urllib.parse import parse_qs
import sqlite3
from datetime import datetime
+ import webbrowser
+ import threading
DB = "budget.db"
@@ -45,7 +47,7 @@ HTML = """
<h1>Budget Tracker</h1>
<form method="POST" action="/add">
- <input name="amount" type="number" step="0.01" placeholder="Amount (+ or -)" required>
+ <input name="amount" type="text" placeholder="Amount (+ or -)" required>
<button type="submit">Add</button>
</form>
@@ -96,11 +98,17 @@ class Handler(BaseHTTPRequestHandler):
self.send_header("Location", "/")
self.end_headers()
+ def open_browser():
+ webbrowser.open("http://localhost:8080")
+
def run():
init_db()
server = HTTPServer(("localhost", 8080), Handler)
+
print("Running on http://localhost:8080")
+ threading.Timer(0.5, open_browser).start()
+
try:
server.serve_forever()
except KeyboardInterrupt: