Issue
I'm running the following in jupyter notebook using python 3:
import tkinter
import tkinter.filedialog
%gui tk
my_file = tkinter.filedialog.askopenfilename()
When I run it the tkinter window launches somewhere behind the browser. How can I raise it to the top?
Solution
I've tested the following code snippet in several jupyter notebooks and it seems to work:
from tkinter import*
# Create Tk root
root = Tk()
# Hide the main window
root.withdraw()
root.call('wm', 'attributes', '.', '-topmost', True)
from tkinter import filedialog
infiles = filedialog.askopenfilename(multiple=True)
%gui tk
So that's what I have so far but I'll keep working on it. I think that there may be some JavaScript solutions out there.
Answered By - James Draper
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.