-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclsRightClick_Test.py
More file actions
39 lines (27 loc) · 1.1 KB
/
clsRightClick_Test.py
File metadata and controls
39 lines (27 loc) · 1.1 KB
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
37
38
39
#from tkinter import *
import tkinter as tk
from tkinter import ttk
import clsRightClickMenu as rightClickMenu
root = tk.Tk()
root.geometry("500x400+200+100")
class Menu_Entry(ttk.Entry):
def __init__(self, master, *args, **kwargs):
super().__init__(master, *args, **kwargs)
rcm = rightClickMenu.RightClickMenu(self)
# call popup menus when right click occurs
self.bind('<Button-3>', rcm.popup)
# bind Ctrl-d to function as in popup menu (Ctrl-d is not a normal functionality)
self.bind("<Control-d>", rcm.delete_selected_with_e1)
# bind Ctrl-a to function as in popup menu (Ctrl-a is not normally handled)
self.bind("<Control-a>", rcm.select_all)
# JUNK ----- I think
#self.bind('<App>', self.popup)
#self.context_menu = Menu(self, tearoff=0)
#self.context_menu.add_command(label="Cut")
#self.context_menu.add_command(label="Copy")
#self.context_menu.add_command(label="Paste")
ent = Menu_Entry(root)
ent.pack()
ent2 = Menu_Entry(root)
ent2.pack()
root.mainloop()