From 7220fb4cdd6b9a67a9e4cdd9ce9ee7c0f7d350b8 Mon Sep 17 00:00:00 2001 From: j Date: Mon, 21 Jan 2019 10:39:08 +0530 Subject: [PATCH] bring to front --- oml/ui.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/oml/ui.py b/oml/ui.py index e7982e9..5c516c5 100644 --- a/oml/ui.py +++ b/oml/ui.py @@ -1,6 +1,6 @@ # encoding: utf-8 # vi:si:et:sw=4:sts=4:ts=4 -DEBUG = False +import sys try: from gi.repository import Gtk, GObject GObject.threads_init() @@ -10,6 +10,8 @@ except: import tkinter.filedialog use_Gtk = False +DEBUG = False + class GtkUI: def selectFolder(self, data): dialog = Gtk.FileChooserDialog(data.get("title", "Select Folder"), @@ -62,6 +64,11 @@ class GtkUI: class TkUI: def __init__(self): self.root = Tk() + if sys.platform == 'darwin': + self.root.lift() + self.root.call('wm', 'attributes', '.', '-topmost', True) + self.root.update() + self.root.after_idle(self.root.call, 'wm', 'attributes', '.', '-topmost', False) self.root.withdraw() # hiding tkinter window def selectFolder(self, data):