Monday, December 23, 2024

macos – Open File Dialogue doesn’t shut after choice (Python 3.13)

I’ve a graph plotting script that in the meanwhile I open utilizing Launcher. It work wonderful and rapidly, however the window for selecting and opening the .xlsx knowledge file does not shut after a file is chosen, and it may well’t be closed. When the file file is chosen by hitting the ;open; button a small empty window ‘tk’ opens. The shell and editor home windows additionally open (I do not want both),

A picture of the graph seems with knowledge factors plotted which I can rotate, save, and so on. If I save the picture, all home windows stay open. If I shut the picture, the tk window and the file choose window additionally shut, and within the editor window present Saving session… …[Process competed]

Right here is the code from the script for selecting a file: (apologies for the way in which the script is displaying, I can’t appear it to point out because it appears in th eedit window)


import tkinter as tk
from tkinter import filedialog
root = tk.Tk()
root.withdraw()
file_path = filedialog.askopenfilename()
print(file_path)

    df = pd.read_excel(file_path)
    print(df.head)
    print(df.columns)

,,,

I am guessing that I’m lacking a line within the tkinter “block”, (replace)I’ve tried including the next earlier than and after a number of different scripts
root.destroy()

however no change

I might prefer to have not one of the home windows present besides the graph. The spreadsheet might be open, however solely the datta from final saved copy is displayed.

Anyone see what I’ve omitted?

Thanks

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles