-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterface_functionality.py
More file actions
36 lines (26 loc) · 1003 Bytes
/
interface_functionality.py
File metadata and controls
36 lines (26 loc) · 1003 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import tkinter as tk
import keyboard
def show_popup():
popup = tk.Toplevel()
popup.title("Popup Window")
# Make the popup fullscreen
popup.attributes("-fullscreen", True)
# Bring the popup to the front and make it active
popup.attributes("-topmost", True)
popup.focus_force()
label = tk.Label(popup, text="You pressed Ctrl + Shift + L!")
label.pack(pady=20)
def close_popup(event=None):
popup.destroy()
popup.bind('<Escape>', close_popup)
popup.protocol("WM_DELETE_WINDOW", lambda: None) # Disable the close button
# close_button = tk.Button(popup, text="Close", command=close_popup)
# close_button.pack(pady=10)
# Create the main window
root = tk.Tk()
root.withdraw() # Hide the main window
# Use the keyboard library to add a hotkey for Ctrl + Shift + L
keyboard.add_hotkey('ctrl+shift+l', show_popup)
# Keep the script running
print("Press Ctrl + Shift + L to show the popup. Press Esc to close the popup.")
root.mainloop()