Reputation: 157
There is a post of this code, posted by mgilson, that I don't understand. All up to the reference to big_widget
makes sense. But, what does the reference to big_widget
contribute? The particular post is here. I am trying to refine my code and, I think, use the Frame
object. But, the reference to Canvas
threw me. I tried to comment but I need 50+ reputation to do so. Not there yet.
import Tkinter as Tk
root = Tk.Tk()
f = Tk.Frame(root)
f.grid(row=0,column=0)
#place buttons on the *frame*
b1 = Tk.Button(f,text="Button1")
b1.grid(row=0,column=0)
b2 = Tk.Button(f,text="Button2")
b2.grid(row=0,column=1)
big_widget = Tk.Canvas(root)
big_widget.grid(row=1,column=0) #don't need columnspan any more.
Upvotes: 0
Views: 65
Reputation: 36732
big_widget = Tk.Canvas(root) --> A Canvas object is initialized, anchored to root and assigned to big_widget
The next line places the canvas (big_widget) at row=1 column=0 on the grid
(in the same way, a frame (f) was previously initialized and placed at row=0 column=0 on the grid inside root)
Upvotes: 1