Frame_tests

This commit is contained in:
jfsScience 2020-12-03 18:23:04 +01:00
parent 421492d009
commit 9305e14806
2 changed files with 62 additions and 1 deletions

View File

@ -272,10 +272,23 @@ class Jfsphoto (object):
def do_math(self):
root = tk.Tk()
center = tk.Frame(root, bg='gray2', width=50, height=40, padx=3, pady=3)
root.grid_rowconfigure(1, weight=1)
root.grid_columnconfigure(0, weight=1)
center.grid(row=1, sticky="nsew")
center.grid_rowconfigure(0, weight=1)
center.grid_columnconfigure(1, weight=1)
ctr_mid = tk.Frame(center, bg='yellow', width=250, height=190, padx=3, pady=3)
ctr_right = tk.Frame(center, bg='green', width=100, height=190, padx=3, pady=3)
ctr_mid.grid(row=0, column=0, sticky="nsew")
ctr_right.grid(row=0, column=1, sticky="ns")
root.title("Mathoptions")
fig = plt.Figure(figsize=(8,4),dpi=100)
ax1 = fig.add_subplot(111)
self.df.plot(x = 'nmscale',y = 'p1', color='red',linewidth=0.6,ax=ax1)
canvas = FigureCanvasTkAgg(fig, master = root)
canvas = FigureCanvasTkAgg(fig, master = ctr_mid)
canvas._tkcanvas.pack(side = tk.TOP, fill = tk.BOTH, expand = 1)
root.mainloop()

48
test_frame.py Normal file
View File

@ -0,0 +1,48 @@
from tkinter import *
root = Tk()
root.title('Model Definition')
root.geometry('{}x{}'.format(460, 350))
# create all of the main containers
#top_frame = Frame(root, bg='cyan', width=450, height=50, pady=3)
center = Frame(root, bg='gray2', width=50, height=40, padx=3, pady=3)
#btm_frame = Frame(root, bg='white', width=450, height=45, pady=3)
#btm_frame2 = Frame(root, bg='lavender', width=450, height=60, pady=3)
# layout all of the main containers
root.grid_rowconfigure(1, weight=1)
root.grid_columnconfigure(0, weight=1)
#top_frame.grid(row=0, sticky="ew")
center.grid(row=1, sticky="nsew")
#btm_frame.grid(row=3, sticky="ew")
#btm_frame2.grid(row=4, sticky="ew")
# create the widgets for the top frame
# model_label = Label(top_frame, text='Model Dimensions')
# width_label = Label(top_frame, text='Width:')
# length_label = Label(top_frame, text='Length:')
# entry_W = Entry(top_frame, background="pink")
# entry_L = Entry(top_frame, background="orange")
# layout the widgets in the top frame
# model_label.grid(row=0, columnspan=3)
# width_label.grid(row=1, column=0)
# length_label.grid(row=1, column=2)
# entry_W.grid(row=1, column=1)
# entry_L.grid(row=1, column=3)
# create the center widgets
center.grid_rowconfigure(0, weight=1)
center.grid_columnconfigure(1, weight=1)
#ctr_left = Frame(center, bg='blue', width=100, height=190)
ctr_mid = Frame(center, bg='yellow', width=250, height=190, padx=3, pady=3)
ctr_right = Frame(center, bg='green', width=100, height=190, padx=3, pady=3)
#ctr_left.grid(row=0, column=0, sticky="ns")
ctr_mid.grid(row=0, column=1, sticky="nsew")
ctr_right.grid(row=0, column=2, sticky="ns")
root.mainloop()