person = input('Please enter your name:')
print('Hello', person,'. How are you today?')

emotion = input('Please enter happy, sad or neither:')
if emotion == 'happy':
    print('Well, it is great to hear that you are so chipper',person,'! Shall we continue?')
    print('Sorry to hear that. Hopefully we can help to cheer you up',person,'!')
print('Okay, just a few more questions before we make a few recommendations on how to make your life more awesome!')

gender = input('Write M if you are a male or F if you are a female:')

DOB = input('Please enter your date of birth (01/30/1985):')

currentcity = input('Where do you live? Enter SF, NYC, LA, CHI, BOS or Other:')
if currentcity == "Other":
    input('Where do you live? Just play along...:')
    print('Thanks,',person,". Continue on to learn more!")


Recommended Answers

Inputs can be handled by the Entry() widget and bound the return key.
For an example see:

Jump to Post

All 3 Replies

Having a ton of difficult understanding how to get this basic set of questions to play nicely with Tkinter

This might give you some important hints about GUI programming:

''' tk_Entry_input101.py
explore multiple tkinter Entry() for inputs
Python2 uses Tkinter
Python3 uses tkinter

# Python3
import tkinter as tk

def name_action(event):
    person = enter1.get().capitalize()
    sf = "Hello {}. How are you today?".format(person)
    result['text']  = sf
    # now move cursor to enter2

def mood_action(event):
    person = enter1.get().capitalize()
    mood = enter2.get().lower()
    if mood == 'happy':
        sf = "{}, nice see you are so chipper!".format(person)
        sf = "Hopefully we can help to cheer you up {}!".format(person)
    result['text']  = sf
    # move cursor in enter3

# the root window
root = tk.Tk()
# window geometry is width x height + x_offset + y_offset

# make a label to display results
result = tk.Label(root)

# first entry with label
label1 = tk.Label(root, text='Please enter your name:')
enter1 = tk.Entry(root, bg='yellow')
# bind enter1 to return key press
enter1.bind('<Return>', func=name_action)
# start cursor in enter1

# second entry with label
label2 = tk.Label(root, text='Please enter happy, sad or neither:')
enter2 = tk.Entry(root, bg='yellow')
# bind enter2 to return key press
enter2.bind('<Return>', func=mood_action)

# position the widgets in the window with grid()
label1.grid(row=1, column=0)
enter1.grid(row=1, column=1)
label2.grid(row=2, column=0)
enter2.grid(row=2, column=1)

# position result label at bottom, span over 2 columns
result.grid(row=5, column=0, columnspan=2)

# the GUI event loop
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.