Skip to content

Commit 6c3b9b4

Browse files
committed
Create ex-23 (Stickynotes).py
1 parent 697b4f8 commit 6c3b9b4

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

ex-23 (Stickynotes).py

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import tkinter as tk
2+
from tkinter import simpledialog
3+
4+
def add_note():
5+
# Create a new window for the sticky note
6+
note_window = tk.Toplevel(root)
7+
note_window.title("Sticky Note")
8+
note_window.geometry("200x200")
9+
10+
# Text widget to write the note
11+
text_widget = tk.Text(note_window, wrap=tk.WORD)
12+
text_widget.pack(expand=True, fill=tk.BOTH)
13+
14+
# Close button
15+
def close_note():
16+
note_window.destroy()
17+
18+
close_button = tk.Button(note_window, text="Close", command=close_note)
19+
close_button.pack()
20+
21+
# Main application window
22+
root = tk.Tk()
23+
root.title("Sticky Notes")
24+
root.geometry("300x200")
25+
26+
# Add button to create a new sticky note
27+
add_button = tk.Button(root, text="Add Note", command=add_note)
28+
add_button.pack(pady=20)
29+
30+
# Start the application
31+
root.mainloop()

0 commit comments

Comments
 (0)