Advertisement
Guest User

Untitled

a guest
Oct 6th, 2017
101
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # -*- coding: utf-8 -*-
  2. from Tkinter import *
  3. import pandas as pd
  4. import matplotlib.pyplot as plt
  5. import numpy as np
  6.  
  7.  
  8.  
  9.  
  10. class App:
  11.  
  12. def __init__(self, master):
  13. master.minsize(width=666, height=666)
  14.  
  15. frame = Frame(master)
  16. frame.pack()
  17.  
  18. self.button = Button(frame, text="KONEC", fg="red", command=master.destroy)
  19. self.button.pack(side=LEFT)
  20.  
  21. self.hi_there = Button(frame, text="Vykresli", command=self.vykresli)
  22. self.hi_there.pack(side=LEFT)
  23. def udaj(self):
  24. L1=Label(top, text="Enter filename, faggot")
  25. L1.pack(side=LEFT)
  26. E1=Entry(top,bd=5)
  27. E1.pack(side=RIGHT)
  28. top.mainloop()
  29. def vykresli(self):
  30. csv = pd.read_csv(E1)
  31. data=csv[['deformacia','napatie']]
  32. data=data.astype(float)
  33. x=data['deformacia']
  34. y=data['napatie']
  35. plt.scatter(x,y,s=0.5)
  36. #toto fituje krivku k bodom.
  37. fit=np.polyfit(x,y,15)
  38. p=np.poly1d(fit)
  39. plt.plot(x,p(x),"r--")
  40. plt.show()
  41.  
  42.  
  43.  
  44.  
  45.  
  46. if __name__=="__main__":
  47.  
  48. root = Tk()
  49. app = App(root)
  50. root.mainloop()
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement