From ee6a0d95fde0ae76576bf466fa4d15acb46cf6c6 Mon Sep 17 00:00:00 2001 From: Jonadabe <986504+Jonadabe@users.noreply.github.com> Date: Mon, 29 Nov 2021 18:01:45 +0000 Subject: [PATCH] Update contextmenu.py readability. --- contextmenu.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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: