def enter_from_file(ent_first, ent_second): """This module takes the 2 Tkinter entry variables as input, generates a popup file explorer dialog to choose a file to use in data entry, and inserts the first two lines of the chosen file into the entry fields.""" f = aof(mode='r', filetypes=[('CSV', '*.csv'), ('JSON', '*.json'), ('Text', "*.txt"), ('All File Types', '*.*')]) if f is not None: content = f.readlines() ent_first.insert(index=1, string=content[0].strip()) ent_second.insert(index=1, string=content[1])
def path_file_disp(): # function to display filepath and File Data filename = aof() path_var.set(filename) try: with open(filename, 'r') as ec_file: str_data = ec_file.read() data_ent.delete('1.0', tk.END) data_ent.insert( '1.0', str_data) # insert function to enter data to Text Widget except: data_ent.delete('1.0', tk.END) data_ent.insert("1.0", 'File not Found or File not Selected')
def butisc(): file = aof(title="Select InitScript file",filetypes=[("Python file","*.py")]) iscent.delete(0,"end") iscent.insert(0,file)
def butico(): file = aof(title="Select Icon file",filetypes=[("Icon file","*.ico")]) icoent.delete(0,"end") icoent.insert(0,file)
def butscr(): file = aof(title="Select Script file",filetypes=[("Python file","*.py")]) scrent.delete(0,"end") scrent.insert(0,file)
def DosyaAç(): dosyaAdý = aof() mesaj.config(text=dosyaAdý)
from tkinter import Tk from tkinter.filedialog import askopenfilename as aof yf.pdr_override() start = dt.datetime(2017, 12, 1) now = dt.datetime.now() # UI element to choose the Excel file choice = input("Choose different file? [y/n]: ") if choice == "y": root = Tk() ftypes = [(".xls", "*.xlsx"),(".xls", "*.xlsm"), (".xls", "*.xls")] ttl = "Title" dir1 = '/Users/antoniogoncalves/' filepath = aof(initialdir = dir1, title = ttl, filetypes = ftypes) else: # set the file path for list of stocks to analyze filepath = r"/Users/antoniogoncalves/Google Drive/Development/Finance/WatchList.xlsx" # export dataframe to the excel # convert excel data into pandas dataframe stockList = pd.read_excel(filepath, "Stocks") #tockList = stockList.head() # export the list into a pandas df exportList = pd.DataFrame(columns = ["Stock", "Current Price", "50 Day MA", "150 Day MA", "200 Day MA", "52 Week High", "52 Week Low", "BUY"]) exportList.set_index("Stock", inplace=True) # Iterate through each of the stocks
def fileOpener(event): entredFile.delete(0,len(entredFile.get())) entredFile.insert(0,aof().name)