diff --git a/contextmenu.py b/contextmenu.py index 4051a49..56d998c 100644 --- a/contextmenu.py +++ b/contextmenu.py @@ -1,9 +1,13 @@ -from tkinter import * -root = Tk() -menu = Menu(root) +# contextmenu.py + +import tkinter +from tkinter import ttk + +root = tkinter.Tk() +menu = tkinter.Menu(root) for i in ('One', 'Two', 'Three'): menu.add_command(label=i) -if (root.tk.call('tk', 'windowingsystem')=='aqua'): +if root.tk.call('tk', 'windowingsystem') == 'aqua': root.bind('<2>', lambda e: menu.post(e.x_root, e.y_root)) root.bind('', lambda e: menu.post(e.x_root, e.y_root)) else: