I am trying to program a GUI that will display three buttons on the top left corner and four buttons on the top right corner of the window. I attempted to do this by creating different frames: A "left" frame where i place the first of the group of buttons and where i will later add more buttons underneath. A "TopLeft corner" frame where i add the remaining two buttons of the first group. A "Topright corner" frame where i fit the first three buttons of the second group. And finally a "right" frame where i fit the final button and where i will later add more buttons as shown in the image attached.
But the problem is that the topleft and topright frames conflict and stack on top of each other, and additionally the topright frame stacks on top of the right frame, does anyone has a fix for this?
This is the current GUI:
This is what I would like to achieve:
from tkinter import *
import tkinter as tk
from tkinter import messagebox
win = tk.Tk()
width_value = win.winfo_screenwidth()
height_value = win.winfo_screenheight()
win.geometry(f"{width_value}x{height_value}+0+0")
win.resizable(False, True)
win.title("Test GUI")
leftFrame = tk.Frame(win)
leftFrame.pack(side=LEFT, anchor=N)
homeImg = PhotoImage(file="home_icon.png")
homeb = Button(leftFrame, image=homeImg, command=homeMenu, height=100,
width=100).pack(padx=10, pady=10)
topLeftFrame = tk.Frame(win, width=200, height=100)
topLeftFrame.pack(side=TOP, anchor=W)
rgbmenuImg = PhotoImage(file="rgb_icon.png")
rgbmenub = Button(topLeftFrame, image=rgbmenuImg, command=rgbmenu, height=100, width=100)
thermalmenuImg = PhotoImage(file="thermal_icon.png")
cameraImg = PhotoImage(file="camera_icon.png")
thermalmenub = Button(topLeftFrame, image=thermalmenuImg, command=thermalmenu, height=100, width=100)
rgbmenub.grid(row=0, column=2, padx=10, pady=10)
thermalmenub.grid(row=0, column=3, padx=10, pady=10)
topRightFrame = tk.Frame(win, width=300, height=100)
topRightFrame.pack(side=TOP, anchor=E)
settImg = PhotoImage(file="settings_icon.png")
settingb = Button(topRightFrame, image=settImg, command=settings, height=100, width=100)
infoImg = PhotoImage(file="copyright_icon.png")
infob = Button(topRightFrame, image=infoImg, command=copyright, height=100, width=100)
loginImg = PhotoImage(file="login_icon.png")
loginb = Button(topRightFrame, image=loginImg, command=login, height=100, width=100)
settingb.grid(row=0, column=1, padx=10, pady=10)
infob.grid(row=0, column=2, padx=10, pady=10)
loginb.grid(row=0, column=3,padx=10, pady=10)
rightFrame = tk.Frame(win)
rightFrame.pack(side=RIGHT, anchor=N)
exitImg = PhotoImage(file="exit_icon.png")
exitb = Button(rightFrame, image=exitImg, command=quit, height=100, width=100).pack(padx=10, pady=10)
dema = Button(rightFrame, text="DEMA Intranet", command=dema_intranet).pack(padx=10, pady=10)
win.mainloop()