The following python code displays a bar graph behind two scrolledtext boxes and a number of buttons. I'm really new at doing python and I'd like to know whether it's possible to resize the graph so that:
(1) its left edge is aligned with the right edges of the scrolledtext boxes;
(2) its top is aligned with the top of button 3;
(3) its bottom is aligned with the bottom edge of the lower scrolledtext box; and,
(4) its right edge is aligned with the right edge of the screen.
import tkinter
from tkinter import Button
from tkinter import scrolledtext as tkst
import numpy as np
import matplotlib
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure
matplotlib.use('TkAgg')
def dummy():
return
ww = tkinter.Tk()
ww.geometry('700x400')
ww.state('zoomed')
datalst = [31, 41, 59, 26, 53, 58, 97, 96, 36]
ff = Figure(figsize=(6,6), dpi=100)
xx = ff.add_subplot(111)
ind = np.arange(len(datalst))
rects1 = xx.bar(ind, datalst, 0.8)
canvas = FigureCanvasTkAgg(ff, master=ww)
canvas.draw()
canvas.get_tk_widget().pack()
butt1 = Button(ww,text='Button 1',command=dummy, height=1,width=20,state='normal')
butt1.place(x=12, y=2)
butt2 = Button(ww,text='Button 2',command=dummy, height=1,width=20,state='disabled')
butt2.place(x=162, y=2)
butt3 = Button(ww,text='Button 3',command=dummy, height=1,width=10,state='disabled')
butt3.place(x=320, y=100)
butt4 = Button(ww,text='Button 4',command=dummy, height=1,width=10,state='disabled')
butt4.place(x=320, y=128)
butt5 = Button(ww,text='Button 5',command=dummy, height=1,width=10,state='disabled')
butt5.place(x=320, y=156)
butt6 = Button(ww,text='Button 6',command=dummy, height=1,width=10,state='disabled')
butt6.place(x=320, y=184)
butt7 = Button(ww,text='Button 7',command=dummy, height=1,width=12,state='disabled')
butt7.place(x=420, y=394)
butt8 = Button(ww,text='Button 8',command=dummy, height=1,width=12,state='disabled')
butt8.place(x=600, y=394)
disp_txt1 = tkst.ScrolledText(ww, width=36, height=12, wrap=tkinter.WORD, state='disabled')
disp_txt1.pack(fill=tkinter.BOTH)
disp_txt1.place(x=410, y=100)
disp_txt2 = tkst.ScrolledText(ww, width=36, height=5, wrap=tkinter.WORD, state='disabled')
disp_txt2.pack(fill=tkinter.BOTH)
disp_txt2.place(x=410, y=300)
ww.mainloop()
The orange rectangle below shows where I intend the graph to be: