Q: Why can't see tkinter button in python 3 scrolling note book tab? I try to make own code, based on working example, but can't. This is my code.
I can't see button on scrolled panel(tkinter.Canvas inside note book tab). And can't understand what wrong. I am confused. win7 64 python 3.4
# -*- coding: utf-8 -*-
import tkinter
from tkinter import ttk

mainframe = tkinter.Tk()
mainframe_width = (mainframe.winfo_screenwidth() / 2 - 200)
mainframe_heigth = (mainframe.winfo_screenheight() / 2 - 250)
mainframe.geometry("%dx%d+%d+%d" % (800, 600, mainframe_width, mainframe_heigth))
mainframe.title('test')
n_book = ttk.Notebook(mainframe)
n_book.pack(fill='both', expand='yes')
n_book.pressed_index = None

x_name=["tab1","tab2","tab3","tab4"]
x_container=[]; x_canvas=[]; x_scroll=[]; x_frame=[]
cw,ch=200,400; fw,fh=200,1000; sr=(0,0,200,1000)

for i in range(4):
    x_container.append(tkinter.Frame(n_book))
    x_container[i].pack(fill=tkinter.BOTH, expand=True)
    n_book.add(x_container[i], text=x_name[i]) # add container to note book
    x_canvas.append(tkinter.Canvas(x_container[i], width=cw, height=ch)) # add canvas to container
    x_scroll.append(tkinter.Scrollbar(x_container[i], command=x_canvas[i].yview)) # add scroll to container
    x_canvas[i].config(yscrollcommand=x_scroll[i].set, scrollregion=sr)
    x_canvas[i].pack(side=tkinter.LEFT, fill=tkinter.BOTH, expand=True)
    x_scroll[i].pack(side=tkinter.RIGHT, fill=tkinter.Y)
    x_frame.append(tkinter.Frame(x_canvas[i], width=fw, height=fh,bg="gray")) # add frame to canvas

cocoa = ttk.Button(mainframe,text="cocoa") # add button to mainframe - worked
cocoa.place(height=40,width=200,relx=0.5,rely=0)

testbtn = ttk.Button(x_frame[0],text="shitbtn") # add button to frame with scroll - NOT WORKED
testbtn.place(height=40,width=200,relx=0.1,rely=0.1)
print(x_frame[0].winfo_children())
mainframe.mainloop()


A: To add a Frame (or any Widget) to a canvas you have to use the create_window method. 
x_frame.append(tkinter.Frame(x_canvas[i], width=fw, height=fh,bg="gray")) # create the Frame
x_canvas[i].create_window(50, 50, window=x_frame[i], anchor='nw') # add frame to canvas

