Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. #Use Tkinter for python 2, tkinter for python 3
  2. import os
  3. import tkinter as tk
  4. import tkinter.ttk as ttk
  5. import matplotlib.pyplot as plt
  6. class MainApplication(tk.Frame):
  7. def __init__(self, parent, *args, **kwargs):
  8. tk.Frame.__init__(self, parent, *args, **kwargs)
  9. self.parent = parent
  10. parent.title("data plotter")
  11. parent.geometry("600x400")
  12. self.Xlabel = ttk.Label(parent, text=" enter your x-cords")
  13. self.Xlabel.pack()
  14. self.xentry = ttk.Entry(parent)
  15. self.xentry.pack()
  16. self.cLabel = ttk.Label(text="enter label")
  17. self.cLabel.pack()
  18. self.customlabel = ttk.Entry(parent)
  19. self.customlabel.pack()
  20. self.fileLabel = ttk.Label(parent, text=" enter your file")
  21. self.fileLabel.pack()
  22. self.filentry = ttk.Entry()
  23. self.filentry.pack()
  24. self.action = ttk.Button(text="plot", command=self.Plotter)
  25. self.action.pack()
  26.  
  27.  
  28.  
  29.  
  30. def Plotter(self):
  31. x_c = []
  32. x_cords = self.xentry.get()
  33. for x in x_cords.split():
  34. int(x)
  35.  
  36. x_c.append(x)
  37.  
  38. plt.legend(["stats",])
  39. plt.ylabel("y-cords")
  40. plt.plot(x_c, marker="^")
  41. plt.xlabel(self.customlabel.get())
  42. plt.savefig(self.filentry.get())
  43. os.startfile(self.filentry.get())
  44.  
  45. if __name__ == "__main__":
  46. root = tk.Tk()
  47. MainApplication(root).pack(side="top", fill="both", expand=True)
  48. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement