Tkinter Scaling Problems

Hi,

I’m trying to embed a Matplotlib graph along with the toolbar in my Tkinter application.

The problem I’m facing is that when I maximize the application, the plot only fills the

top half of the screen and the bottom half is taken up by the toolbar with a lot of whitespace.

I based my code on the embedding_with_tk examples, and I’ve tried every layout combination

with pack(), but I still can’t get just the plot to take up all the space. This is the relevant code:

    f2 = Tkinter.Frame(n())
    canvas = FigureCanvasTkAgg(f, master=f2)
    canvas.show()
    canvas.get_tk_widget().pack(side=Tkinter.TOP, fill=Tkinter.BOTH, expand=1)
    toolbar = NavigationToolbar2TkAgg(canvas, f2)

    toolbar.update()
    canvas._tkcanvas.pack(side=Tkinter.BOTTOM, fill=Tkinter.BOTH, expand=0)

Any help would be welcome.

Thanks,

KK

Hi,

I’m trying to embed a Matplotlib graph along with the toolbar in my Tkinter application.

The problem I’m facing is that when I maximize the application, the plot only fills the

top half of the screen and the bottom half is taken up by the toolbar with a lot of whitespace.

I based my code on the embedding_with_tk examples, and I’ve tried every layout combination

with pack(), but I still can’t get just the plot to take up all the space. This is the relevant code:

    f2 = Tkinter.Frame(n())
    canvas = FigureCanvasTkAgg(f, master=f2)
    canvas.show()
    canvas.get_tk_widget().pack(side=Tkinter.TOP, fill=Tkinter.BOTH, expand=1)
    toolbar = NavigationToolbar2TkAgg(canvas, f2)

    toolbar.update()
    canvas._tkcanvas.pack(side=Tkinter.BOTTOM, fill=Tkinter.BOTH, expand=0)

Any help would be welcome.

Thanks,

KK