tags:

views:

19

answers:

1

I cannot see my left frame with a button inside (I'm using TKinter).. This is my code:

#create window & frames
root = Tk()
root.title( "Medical Visualization" )

rootFrame = Frame(root)
rootFrame.pack( fill=BOTH, expand=1, side=TOP )

leftframe = Frame(root, width=100, bg="blue")
leftframe.pack(fill=X, expand=True)

button = Button(leftframe, text="Add Isosurface", fg="red")
button.pack( side = LEFT)

root.mainloop()

thanks

A: 

I see it, and looking at the code I see nothing that would prevent it from being seen. Are you remembering to call root.mainloop? Your code snippet doesn't show you calling that method.

Bryan Oakley
yeah sorry, I forgot to copy paste it. I have it. Question updated
Patrick
@Patrick: are you *certain* the above code doesn't work for you? (you're also missing an import statement, so I'm wondering if there is other code that is missing or might be causing the problem). When I add the missing import statement I can see the button.
Bryan Oakley
@Bryan Oakley is the import statement: "from Tkinter import *" ?
Patrick
@Patrick: yes, that's what I used. That's not really the best way IMO, but I assumed that's what you were doing based on your code. It would be better to do something like `import Tkinter as tk` and then use `tk.Button`, `tk.Frame`, etc.
Bryan Oakley