tkinter - Python GUI frame and button layout, how to add frame and buttons to correct location? -


def create_layout(frame):  frame = frame(frame, bg = 'red') frame.pack(side = left, fill=both)  b = button(frame, text='button1', command=pressed, padx = 20) b.pack(pady = 20, padx = 20) c = button(frame, text='button2', command=pressed, padx=20) c.pack(pady = 20, padx = 20) 

i got code far, assume tkinter import * has been called , frame has had size , colour set. should picture below. can't ever button 3 , 4 frame on right, whenever add button goes in red frame.

enter image description here

you need add frame sits right, , pack button3 , button4 that. maybe change previous frame have there frame1 , have:

frame2 = frame(frame, bg = "yellow") frame2.pack(side = right, fill = both) 

then, create buttons , pack them in. hope helps!


Comments