I’m trying to create a prog that can take the data from (open) in the menu bar and then can edit and
plot it but always have issues!!
import os
from tkinter import *
import pandas as pd
from tkinter import filedialog
#prog name
gsp = Tk()
gsp.title('Geos Platform')
# gsp.state('zoomed')
#gsp.iconbitmap('E:\Restmar\earth.ico')
#create menu bar
my_menu = Menu(gsp)
file_menu = Menu(my_menu, tearoff=0)
my_menu.add_cascade(label= "File ", menu=file_menu)
file_menu.add_command(label= "New")
file_menu.add_command(label= "Open", command=lambda: open_the_file())
file_menu.add_separator()
file_menu.add_command(label= "Save")
file_menu.add_separator()
file_menu.add_command(label= 'Exit', command=gsp.quit)
method_choice = Menu(my_menu, tearoff=0)
my_menu.add_cascade(label= "Method", menu=method_choice)
def r_method():
pass
def g_method():
pass
def gg_method():
pass
def s_method():
pass
method_choice.add_command(label= "r", command= r_method)
method_choice.add_separator()
method_choice.add_command(label= "g", command= r_method)
method_choice.add_separator()
method_choice.add_command(label= "gg", command= g_method)
method_choice.add_separator()
method_choice.add_command(label= "s", command= s_method)
about_info = Menu(my_menu, tearoff=0)
my_menu.add_cascade(label= "Help", menu=about_info)
def about_soft():
pass
def about_devo():
pass
about_info.add_command(label= "About Software", command= about_soft)
about_info.add_separator()
about_info.add_command(label= "About Devoloper", command= about_devo)
gsp.config(menu=my_menu)
#Open file function
def open_the_file():
open_file = filedialog.askopenfilename(title='Open Excel File',initialdir='/',
filetype=(("Excel Sheet",".xlsx"),("Excel Sheet",".xlsm"),("Excel Sheet",".xls") ))
global xlsx
xlsx = pd.ExcelFile(open_file)
read_excelr()
def read_excelr():
df=pd.read_excel(xlsx, index_col=0)
print(df)
# HERE IS THE QUESTION
gsp.mainloop()
How can I get out the data from that function and work with and even edit it!
another last question when I import one single part of another module it imports all if it!!
from xxx import func!
Hope to find an answer