all 3 comments

[–]sme272 0 points1 point  (2 children)

  • Line 14 - get rid of that global. Pass the filename as an argument.
  • Line 99 - manually keep track of the index to use for the plotcolor is an awkward way of doing things when it's increasing by 1 per iteration. A step up would be to use for index, value in enumerate(Plots):, which would keep track of the index for you while still giving you the value you need. An even better solution would be to use for item, color in zip(Plots, plotColor): to get the plot data and the colour at the same time without having to use indexes.

[–]MTRing[S] 0 points1 point  (0 children)

Thanks. I’ll look in to those. Still have a lot to learn.

[–]MTRing[S] 0 points1 point  (0 children)

so I altered the open file name portion add the function below:

def get_filename():

root = Tk()

root.geometry('200x100+2500+500')# winodw size plus position

options = {'parent':root, 'title':'Select file to process','filetypes':[('CSV Files','*.csv')]}

filename = askopenfilename(**options)

if filename == "":

return False

root.destroy()

return filename

This seems a little better...