Description
What I'm trying to do is an app with a navbar on top that depending on which one is shows different things on the body of the app (below the navbar). I'm using the grid so I'm iterating through a list and adding a button to the body of the app and they have columnspan but they position in the middle of the columnspan
This is how it looks right now.
Desired Layout
This is a little sketch of the layout (the right bar below the navbar is a scrollbar which isn't implemented yet because I don't know yet how to do it)
Code
import modules.configManager as configManager
import tkinter as tk
from tkinter import messagebox
import tkinter.font as font
from os.path import dirname, abspath
from PIL import Image, ImageTk
imgDirectory = dirname(dirname(abspath(__file__))) + '\img'
logo = imgDirectory + '\logo2.jpg'
root = tk.Tk()
def linkMenu():
links = configManager.readConfig()['linksList']
i = 0
for link in links:
i = i+1
linkB = tk.Button(root,text=link['link'],font=font.Font(font='Helvetica',size=8),width=30,relief='flat')
linkB.grid(column=0,row=i,columnspan=4)
def navbar():
buttonWidth = 18
buttonHeight = 1
myfont = font.Font(font='Helvetica',size=10,weight="bold")
homeButton = tk.Button(root, text="Home",height=buttonHeight,width=buttonWidth,font=myfont)
homeButton.grid(column=0,row=0)
linkButton = tk.Button(root, text="Links",width=buttonWidth,font=myfont,command=linkMenu)
linkButton.grid(column=1,row=0)
groupsButton = tk.Button(root, text="Groups",width=buttonWidth,font=myfont)
groupsButton.grid(column=2,row=0)
resetButton = tk.Button(root, text="Reset",width=buttonWidth,font=myfont)
resetButton.grid(column=3,row=0)
exitButton = tk.Button(root,text="Exit",width=buttonWidth,font=myfont,command=exit)
exitButton.grid(column=4,row=0)
def interface():
navbar()
root.title("LinkManager")
root.geometry("1040x500")
root.mainloop()
Thanks in advance and if it isn't clear tell me please :D