[python][tkinter] - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: [python][tkinter] (/thread-20323.html) |
[python][tkinter] - NEL - Aug-05-2019 Hi guys. I created Notebook in tkinter and put there graph and table. My graph has grey area around it and I cannot remove that extra space. This does not allow to properly position the table around the graph and add space.I tried using place(x,y), but it does not work. Could you please give advise how to remove extra space ( I cooled grey the space around figure for you to see how much space it takes. I can colour it of the background colour however it does not allow to position table and it looks ugly). I will really appreciate to get your help as I struggle with it. 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 = 'purple', width=0,height=0) self.style.configure('TCanvas',background = 'yellow', width=0,height=0,font='serif 10') self.style.configure('TButton',background = 'blue') self.style.configure('TLabel', background = 'white',font = ('Arial', 15)) self.style.configure("TNotebook", background='#1b1b1b', borderwidth=0) self.style.configure("TNotebook.Tab", background='blue', foreground='black',font = ('Arial', 15, 'bold')) notebook=ttk.Notebook(master,style="TNotebook") notebook.pack(side=LEFT, anchor='sw') 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.tail() graph2 = ttk.Frame(master) graph2.pack() self.sub = ttk.Frame(notebook) self.sub.place(x=100,y=200) notebook.add(self.sub, text='graph') notebook.pack(side=LEFT, anchor='sw',) fig2 = matplotlib.pyplot.Figure(figsize=(5,6),dpi=60, facecolor='grey') canvas3 = FigureCanvasTkAgg(fig2, self.sub) canvas3.get_tk_widget().grid(row=0,column=1) ax3 = fig2.add_subplot(211) self.frame_content.place(x=30,y=10) a.plot(kind='line', legend=True, ax=ax3, color='blue') ttk.Label(self.sub, text = a, font = ('monospace')).grid(row=0,column=0) def main(): root = Tk() scr = Scr(root) root.mainloop() if __name__ == "__main__": main() RE: [python][tkinter] - Larz60+ - Aug-05-2019 you set the background of root to grey9, therefore any window that is smaller than the geometry you specify, 900x900 especially with margins of 120 and 60 will be surrounded by grey9. RE: [python][tkinter] - NEL - Aug-06-2019 what I mean is the grey coloy not gray9. I mean the color around plot graph not overall. |