Aug-03-2019, 06:37 AM
from tkinter import * from tkinter import ttk import numpy as np import pandas as pd from pandas_datareader import data as wb import matplotlib.pyplot as plt from yahoofinancials import YahooFinancials from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg import matplotlib matplotlib.use('TkAgg') plt.style.use('dark_background') class Scr: def __init__(self, master): master.geometry('900x900+120+60') master.configure(background = 'gray9') self.style = ttk.Style() self.style.theme_use('clam') self.style.configure('TFrame',background = 'green') self.style.configure('TCanvas',background = 'yellow', width=0,height=0,font='serif 10') self.style.configure('TButton',background = 'blue') self.style.configure('TLabel', background = 'pink',font = ('Arial', 15)) self.frame_content = ttk.Frame(master) self.frame_content.pack() options = ['AAPL'] m = pd.DataFrame() for o in options : m[o] = wb.DataReader(o, data_source='yahoo', start='2004-1-1')['Adj Close'] a=m graph2 = ttk.Frame(master) graph2.pack() fig2 = matplotlib.pyplot.Figure(figsize=(6,6)) canvas3 = FigureCanvasTkAgg(fig2, graph2) canvas3.get_tk_widget().grid(padx=0, pady=0,sticky="nswe") ax3 = fig2.add_subplot(211) a.plot(kind='line', legend=True, ax=ax3, color='blue') def main(): root = Tk() scr = Scr(root) root.mainloop() if __name__ == "__main__": main()