i am having problems creating multiple frames and getting them in the right place. i want to put 4 frames on my display so i can have a display like the first attachments but this its not working and the 2 frame is going straight to the middle when i say column 0 and frame 3 disappears because frame 2 is in the way. frame 1 and 4 seem to be working fine just having problem with frame 2 and 3. here my code, hope someone can put me in the right direction as this is my first time creating a gui in python.

from Tkinter import *

root = Tk()
root.title("Malware Scanner")
root.geometry("600x400")
root.configure(background='#BDBDBD')

titleWidget = Frame(root, width = 600, height = 60, bd=1, bg='#BDBDBD', relief=SUNKEN)
titleWidget.grid_propagate(False)
buttonWidget = Frame(root, width = 100, height = 200, bd=1, bg='#BDBDBD', relief=SUNKEN)
labelWidget = Frame(root, width = 200, height = 250, bd=1, bg='#BDBDBD', relief=SUNKEN)
label2Widget = Frame(root, width = 600, height = 90, bd=1, bg='#BDBDBD', relief=SUNKEN)

titleWidget.grid(row = 0, column = 0)
labelWidget.grid(row = 1, column = 0)
label2Widget.grid(row = 2, column = 0)
buttonWidget.grid(row = 1, column = 1)

root.mainloop()

Just a sample:

''' tk_LabelFrame_grid_layout1.py
grid layout of frames

'''

try:
    # Python2
    import Tkinter as tk
except ImportError:
    # Python3
    import tkinter as tk

root = tk.Tk()
root.geometry("320x400")

frame1 = tk.LabelFrame(root, text="frame1", width=300, height=130, bd=5)
frame2 = tk.LabelFrame(root, text="frame2", width=150, height=130, bd=5)
frame3 = tk.LabelFrame(root, text="frame3", width=140, height=100, bd=5)
frame4 = tk.LabelFrame(root, text="frame4", width=300, height=130, bd=5)

frame1.grid(row=0, column=0, columnspan=2, padx=8)
frame2.grid(row=1, column=0, padx=8)
frame3.grid(row=1, column=1, sticky='nw')
frame4.grid(row=2, column=0, columnspan=2)

root.mainloop()

When you use grid() the width of the grid column is determined by the largest widget width in it. Dito for height.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.