When I put graphs on my tkinter window, it shows all of the graphs, not just one. The way I want it is you press a button, and the corresponding graph will show up (along with some other data). I believe its an issue with my buttons, as its trying to call the function for all of the stocks at once, rather than just one at a time based on what button you press.
import numpy as np
import datetime as dt
import yahoo_finance as yf
import matplotlib.pyplot as plt
from Tkinter import *
import quandl
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
root=Tk()
root.geometry('800x800')
root.title("Stock Information")
f1=Frame(root, width=100, height=100)
f1.pack()
today=dt.date.today()
thirty_days=dt.timedelta(days=43)
thirty_days_ago=today-thirty_days
def stock_info(stock_name):
stock=yf.Share(stock_name)
stock_price=stock.get_price()
name_price_label=Label(f1, text=(stock_name,':', stock_price),font=("Times New Roman",23))
name_price_label.grid(row=1, column=3)
data = quandl.get("WIKI/"+str(stock_name), start_date=str(thirty_days_ago), end_date=str(today),column_index=4)
fig = plt.figure(1)
t = np.arange(0.0,3.0,0.01)
s = np.sin(np.pi*t)
plt.plot(data)
canvas = FigureCanvasTkAgg(fig, master=f1)
plot_widget = canvas.get_tk_widget()
plot_widget.grid()
apple_button=Button(root,text='AAPL', command=stock_info('AAPL'))
tesla_button=Button(root,text='TSLA', command=stock_info('TSLA'))
google_button=Button(root,text='GOOG', command=stock_info('GOOG'))
apple_button.pack(anchor='w')
tesla_button.pack(anchor='w')
google_button.pack(anchor='w')
root.mainloop()