File tree 1 file changed +31
-0
lines changed
1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
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 ()
You can’t perform that action at this time.
0 commit comments