-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainFrame.py
53 lines (40 loc) · 1.29 KB
/
MainFrame.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
'''
Created on Nov 15, 2015
@author: TranBui
'''
from Tkinter import Frame,BOTH,Tk
import datetime
from ChartingCanvas import ChartingCanvas
from StockReader import StockReader
from MatplotCharting import MatplotCharting
class MainFrame(Frame):
'''
presents our human interface in an TkInter image window
The size for the frame is 700x700
'''
def __init__(self, root, symbol, start, end):
'''
Constructor
'''
Frame.__init__(self, root, background="white")
#Create the stock reader
self.stockReader =StockReader(symbol, start, end)
self.root = root
#Create the canvas. We also pass in the stock reader (data) to the canvas
self.canvas = ChartingCanvas(root, self.stockReader)
self.initUI()
def initUI(self):
self.root.title(self.canvas.chartTitle)
self.pack(fill=BOTH, expand = 0)
def main():
root = Tk()
root.geometry("700x700+300+0")
d1 = datetime.datetime(2015, 1, 1)
d2 = datetime.datetime.today()
mainFrame = MainFrame(root,"AAPL", d1, d2)
#Plotting with matplot
stockReader =StockReader("AAPL", d1, d2)
matplotCharting = MatplotCharting(stockReader)
root.mainloop()
if __name__ == '__main__':
main()