# Tkinter Display Image Python 3.0



## tsujp (Mar 2, 2008)

So I started Python yesterday and I am ambitiously trying to make this program which when a name is entered will display a picture saying "Happy Birthday!"

I have tried some other methods and Google'd around but nothing works :S

In the code below I want to replace *test.set('Test')* with whatever will display the image.

Here is my code:

```
from tkinter import *
from tkinter import ttk

root = Tk()
root.title('Some Program')

def cname(*args):
    try:
        dname = str(name.get())
        if dname == 'Jess':
            test.set('Test')
    except ValueError:
        pass

mainwin = ttk.Frame(root, padding='3 3 12 12')
mainwin.grid(column=0, row=0, sticky=(N, W, E, S))
mainwin.columnconfigure(0, weight=1)
mainwin.rowconfigure(0, weight=1)

test = StringVar()
name = StringVar()

name_entry = ttk.Entry(mainwin, width=22, textvariable=name).grid(column=2, row=1, sticky=(W, E))

ttk.Label(mainwin, text='Full name').grid(column=1, row=1, sticky=(W, E))
ttk.Label(mainwin, text='Entry is case sensitive').grid(column=2, row=2, sticky=(W))
ttk.Label(mainwin, textvariable=test).grid(column=1, row=3, sticky=(W))

for child in mainwin.winfo_children(): child.grid_configure(padx=5, pady=5)

root.bind('<Return>', cname)

root.mainloop()
```
Thanks for any help guys.


----------

