def changeLbox(self, mytab): root = gFunc.getRoot(mytab) mynewdata = tfgiag.askopenfilenames(parent=root, title='Choose a file', filetypes=[('CSV files', '.csv')]) vals = [] self.mainEventBox["values"] = vals if mynewdata: #reset old variables self.pb.start() self.data.maindata = pd.DataFrame() self.lbox.delete(0, self.lbox.size()) #populate lists and data for myfile in root.tk.splitlist(mynewdata): foo = pd.read_csv(myfile, error_bad_lines=False) if (self.data.maindata.empty): self.data.setMainData(foo) else: self.data.appendMainData(foo) eventlist = [] for eventID in foo["Event ID"].unique(): self.lbox.insert(END, eventID) eventlist.append(eventID) vals.append(eventID) print myfile self.mainEventBox["values"] = vals self.mainEventBox.set(vals[0]) self.pb.stop() else: print "Cancelled" return mynewdata
def changeLbox(self, mytab): root = gFunc.getRoot(mytab) mynewdata = tfgiag.askopenfilenames(parent=root,title='Choose a file',filetypes=[('CSV files', '.csv')]) vals = [] self.mainEventBox["values"] = vals if mynewdata: #reset old variables self.pb.start() self.data.maindata = pd.DataFrame() self.lbox.delete(0, self.lbox.size()) #populate lists and data for myfile in root.tk.splitlist(mynewdata): foo = pd.read_csv(myfile, error_bad_lines=False) if (self.data.maindata.empty): self.data.setMainData(foo) else: self.data.appendMainData(foo) eventlist = [] for eventID in foo["Event ID"].unique(): self.lbox.insert(END, eventID) eventlist.append(eventID) vals.append(eventID) print myfile self.mainEventBox["values"] = vals self.mainEventBox.set(vals[0]) self.pb.stop() else: print "Cancelled" return mynewdata
def transweek(self): year = self.year.get('1.0', 'end') week = self.week.get('1.0', 'end') try: year = int(year) week = int(week) cal = gFunc.iso_to_gregorian(year, week, 1) self.calendar.set(cal.strftime("%d %B %Y"), False) except: print "Need to enter numbers for week and year"
def main(): pd.options.mode.chained_assignment = None pd.set_option('display.max_rows', None) pd.set_option('display.max_columns', None) pd.set_option('expand_frame_repr', False) print "Pandas version: {}".format(pd.__version__) print "Fun Fact Finder now online!!" maindata = data.datasets() root = Tk() #removing the Tkinter logo by creating a temp blank icon file ICON = (b'\x00\x00\x01\x00\x01\x00\x10\x10\x00\x00\x01\x00\x08\x00h\x05\x00\x00' b'\x16\x00\x00\x00(\x00\x00\x00\x10\x00\x00\x00 \x00\x00\x00\x01\x00' b'\x08\x00\x00\x00\x00\x00@\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' '\x00\x01\x00\x00\x00\x01') + b'\x00'*1282 + b'\xff'*64 _, ICON_PATH = mkstemp() with open(ICON_PATH, 'wb') as icon_file: icon_file.write(ICON) root.iconbitmap(default=ICON_PATH) root.title("Fun Fact Finder") root.protocol("WM_DELETE_WINDOW",lambda: ask_quit(root, maindata)) root.geometry('800x800+10+10') root.minsize(550,500) root.columnconfigure(0, weight=1) root.rowconfigure(0, weight=1) tkk.Sizegrip(root).grid(column=999, row=999, sticky=(S,E)) mytabs = tkk.Notebook(root) tabevents = Frame(mytabs) mytabs.add(tabevents, text="Choose Events") taboptions = Frame(mytabs) mytabs.add(taboptions, text="Options") mytabs.tab(1, state="disabled") tabudfs = Frame(mytabs) mytabs.add(tabudfs, text="UDFs") mytabs.tab(2, state="disabled") tabreports = Frame(mytabs) mytabs.add(tabreports, text="Reports") mytabs.tab(3, state="disabled") taboutput = Frame(mytabs) mytabs.add(taboutput, text="output") mytabs.tab(4, state="disabled") reportTab = gRTab.ReportsTab(tabreports, maindata) udfTab = gUTab.UDFTab(tabudfs, reportTab, maindata) eventsTab = gETab.EventsTab(tabevents, reportTab, udfTab, maindata) optionsTab = gOTab.OptionsTab(taboptions, maindata) outputTab = gOut.output(taboutput) maindata.setoutput(outputTab) #Adding Menu root.option_add('*tearOff', FALSE) menubar = Menu(root) root['menu'] = menubar menu_file = Menu(menubar) menubar.add_cascade(menu=menu_file, label='File') menu_file.add_command(label='Open', command=lambda: gFunc.loadreports(mytabs, tabevents, eventsTab)) mytabs.grid(row=0, column=0, sticky=(N,E,S,W)) root.mainloop()
def main(): pd.options.mode.chained_assignment = None pd.set_option('display.max_rows', None) pd.set_option('display.max_columns', None) pd.set_option('expand_frame_repr', False) print "Pandas version: {}".format(pd.__version__) print "Fun Fact Finder now online!!" maindata = data.datasets() root = Tk() #removing the Tkinter logo by creating a temp blank icon file ICON = ( b'\x00\x00\x01\x00\x01\x00\x10\x10\x00\x00\x01\x00\x08\x00h\x05\x00\x00' b'\x16\x00\x00\x00(\x00\x00\x00\x10\x00\x00\x00 \x00\x00\x00\x01\x00' b'\x08\x00\x00\x00\x00\x00@\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' '\x00\x01\x00\x00\x00\x01') + b'\x00' * 1282 + b'\xff' * 64 _, ICON_PATH = mkstemp() with open(ICON_PATH, 'wb') as icon_file: icon_file.write(ICON) root.iconbitmap(default=ICON_PATH) root.title("Fun Fact Finder") root.protocol("WM_DELETE_WINDOW", lambda: ask_quit(root, maindata)) root.geometry('800x800+10+10') root.minsize(550, 500) root.columnconfigure(0, weight=1) root.rowconfigure(0, weight=1) tkk.Sizegrip(root).grid(column=999, row=999, sticky=(S, E)) mytabs = tkk.Notebook(root) tabevents = Frame(mytabs) mytabs.add(tabevents, text="Choose Events") taboptions = Frame(mytabs) mytabs.add(taboptions, text="Options") mytabs.tab(1, state="disabled") tabudfs = Frame(mytabs) mytabs.add(tabudfs, text="UDFs") mytabs.tab(2, state="disabled") tabreports = Frame(mytabs) mytabs.add(tabreports, text="Reports") mytabs.tab(3, state="disabled") taboutput = Frame(mytabs) mytabs.add(taboutput, text="output") mytabs.tab(4, state="disabled") reportTab = gRTab.ReportsTab(tabreports, maindata) udfTab = gUTab.UDFTab(tabudfs, reportTab, maindata) eventsTab = gETab.EventsTab(tabevents, reportTab, udfTab, maindata) optionsTab = gOTab.OptionsTab(taboptions, maindata) outputTab = gOut.output(taboutput) maindata.setoutput(outputTab) #Adding Menu root.option_add('*tearOff', FALSE) menubar = Menu(root) root['menu'] = menubar menu_file = Menu(menubar) menubar.add_cascade(menu=menu_file, label='File') menu_file.add_command( label='Open', command=lambda: gFunc.loadreports(mytabs, tabevents, eventsTab)) mytabs.grid(row=0, column=0, sticky=(N, E, S, W)) root.mainloop()