![]() From there, we plot as usual some x coordinates and some y. Toolbar = NavigationToolbar2TkAgg(canvas, self)Ĭanvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True)įirst we are defining our figure, then adding a subplot. Typical stuff here, with a navigation back to head back to the main page.Ī.plot(,)Ĭanvas.get_tk_widget().pack(side=tk.BOTTOM, fill=tk.BOTH, expand=True) Label = tk.Label(self, text="Graph Page!", font=LARGE_FONT)īutton1 = ttk.Button(self, text="Back to Home",Ĭommand=lambda: controller.show_frame(StartPage)) We will just be temporarily using this Figure, but that's okay. Next, we import the FigureCanvasTkAgg as well as the navigation bar that is used with Matplotlib.įinally, we import Figure. Normally, using the default is perfectly fine, but we need to change this for our uses here. Next, we specifiy the backend, "TkAgg" that we wish to use with Matplotlib. The first just imports the Matplotlib module. ![]() Now we're going to need to add the following imports to our Tkinter application:įrom _tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg If you need help with pip, check out the pip tutorial. ![]() You can also use pip to install using: pip install matplotlib in cmd.exe / bash. There are many ways to get Matplotlib, head over to to download. Here's how!įirst, we're going to be using Matplotlib, so, if you do not have it, you will need to get it. To do this, we first need to know how to actually embed a Matplotlib graph into a Tkinter application. Not only do we want to just plot the prices, but many people will want to see prices in the form of OHLC candlesticks, and then others will also want to see various indicators like EMA/SMA crossovers and things like RSI or MACD. Since we are creating a bitcoin trading application, it only makes sense that we're going to have to incorporate some price data.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |