I am trying to build a very simple GUI, done that before this way, never a problem. Right now, on a Mac, I can't seem to make it work.
This is the code
from Tkinter import *
class App:
def __init__(self, master):
# Gui Creation Block
frame = Frame(master, bd=2, relief=SUNKEN)
self.master = master
self.top = Frame(frame, height=150, width=700, relief=SUNKEN)
self.left = Frame(frame , height=400, width=200, relief=SUNKEN)
self.right = Frame(frame, height=400, width=500, relief=SUNKEN)
self.top.grid(row=0, column=0, columnspan=2)
self.left.grid(row=1, column=0)
self.right.grid(row=1, column=1)
# Sample Label
self.lbl = Label(frame, text="Log file locaction" )
self.lbl.grid(row=0, column=0)
self.top.pack()
frame.pack()
# Run the programs
root = Tk()
app = App(root)
root.mainloop()
As soon as I run that, the CPU usage skyrockets to 100% and stays there until I hard kill the python instance running there. If I comment out the label bit, that doesn't happen. So what is wrong here?
------ Update -------
Okay, changed that file locator thing yeah, that was a messy one. And removing the pack() from top solved the 100% cpu issue.
However, it still is not behaving like I want.
self.top = Frame(frame, bg="black", height=150, width=700, relief=SUNKEN)
self.left = Frame(frame , height=400, width=200, relief=SUNKEN)
self.right = Frame(frame, height=400, width=500, relief=SUNKEN)
Should create 3 blocks in which I can place other widgets, but as soon as I add the third label, like this;
# Sample Label
self.lbl = Label(self.top, text="Top" )
self.lbl.pack()
# Sample Label
self.lbl2 = Label(self.left, text="Left" )
self.lbl2.pack()
# Sample Label
self.lbl3 = Label(self.right, text="Right" )
self.lbl3.pack()
It resizes my whole app down to minimum size. Am I wrong in thinking that internal widgets don't change their parent containers or am I making another mistake?