Hi. I'm creating an interface using the Tkinter library, but I seem to be having some issues with placing 3 buttons BELOW 3 buttons which are on top. All buttons should be inside the second LabelFrame. I've looked all over and I can't seem to figure out why the other buttons are not placing themselves below the top 3. I've tried various options using the pack method such as side = BOTTOM or anchor = SW, but they don't seem to be helping at all.
from Tkinter import *
def __init__(self, r):
self.r = r
self.i = StringVar()
self.f = Frame(self.r)
self.f.pack(fill = BOTH)
self.g = LabelFrame(self.f, text = 'Groupbox 1', height = 90, width = 150, font = 'Lucida 8')
self.g.pack(side = LEFT, pady = 10, padx = 10)
self.id = Entry(self.g, justify = CENTER, textvariable = self.i, font = 'Lucida 8')
self.id.pack(pady = 22)
self.opt = LabelFrame(self.f, text = 'Groupbox 2', height = 90, width = 200, font = 'Lucida 8')
self.opt.pack(side = LEFT)
self.button1 = Button(self.opt, text = 'Button 1', height = 1, width = 7, font = 'Lucida 8')
self.button1.pack(side = LEFT, anchor = N, pady = 5, padx = 4)
self.button2 = Button(self.opt, text = 'Button 2', height = 1, width = 7, font = 'Lucida 8')
self.button2.pack(side = LEFT, anchor = N, pady = 5, padx = 4)
self.button3 = Button(self.opt, text = 'Button 3', height = 1, width = 7, font = 'Lucida 8')
self.button3.pack(side = LEFT, anchor = N, pady = 5, padx = 4)
self.button4 = Button(self.opt, text = 'Button 4', height = 1, width = 5, font = 'Lucida 8')
self.button4.pack(side = BOTTOM, anchor = W)
# Buttons 5 & 6 will be added, but I'd first like to rectify button 4's issue.
t = Tk()
#t.configure(bg = 'white')
As stated, I've changed the options in the button4's pack method, but it doesn't seem to want to place itself directly beneath the other buttons. It's placing itself to the right. I'd like to stay away from the grid manager, as I've already gotten most of what I need in the right place.
I'd appreciate any help in this situation, and hopefully it wasn't a simple mistake on my part.
1 Year Ago
Related Article:Using Python/Tkinter to make C++ API calls
is a solved Python discussion thread by runge_kutta that has 3 replies, was last updated 2 years ago and has been tagged with the keywords: api, c++, gui, python, tkinter.