Question: I'm trying to make a test for some of my students where they need to type in missing words from a paragraph (see picture). The key problem I'm hitting is trying to embed input boxes into a text paragraph, so that when there is a gap, tkinter can make an entry box for the student to type in.

Sketch of desired Output:

[Target](https://i.stack.imgur.com/wP42t.png)
---------------------------------------------

Code attempt:

```
import tkinter as tk

root = tk.Tk()
tk.Label(root, font=("Comic Sans MS",24,"bold"),\
         text="The largest bone in the human body is the").grid(row=0,column=0)
ent1 = tk.Entry(root)
ent1.grid(row=0,column=1)
tk.Label(root, font=("Comic Sans MS",24,"bold"),\
         text="which is found in the").grid(row=0,column=2)
ent2 = tk.Entry(root)
ent2.grid(row=0,column=3)
tk.mainloop()

```

Thank you for reading, and any help is very much appreciated.

Answer: 
You can add widgets to a text widget with the `window_create` method. 

Here's a quick example to show how you can use it to embed widgets into a block of text. The code inserts a string that contains `{}` wherever you want an entry widget. The code then searches for that pattern in the widget, deletes it, and inserts an entry widget.

```
import Tkinter as tk

quiz = (
    "The largest bone in the human body is the {} "
    "which is found in the {}. It is mainly made "
    "of the element {}, and is just below the {}."
)

root = tk.Tk()

text = tk.Text(root, wrap="word")
text.pack(fill="both", expand=True)

text.insert("end", quiz)

entries = []
while True:
    index = text.search('{}', "1.0")
    if not index:
        break
    text.delete(index, "%s+2c"%index)
    entry = tk.Entry(text, width=10)
    entries.append(entry)
    text.window_create(index, window=entry)

root.mainloop()

```
You can insert entries in a text widget, example below.

```
import tkinter as tk

root = tk.Tk()

text = tk.Text(root)
text.pack()

text.insert('end', 'The largest ')

question = tk.Entry(text, width=10)
text.window_create('end', window=question)

text.insert('end', ' in the human body is...')

root.mainloop()

```