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

#QUESTION TWO
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?')
else:
    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!')

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

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

#QUESTION FIVE
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...:')
else:
    print('Thanks,',person,". Continue on to learn more!")

#CONTINUE BUTTON

Recommended Answers

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
note:
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
    enter2.focus_set()

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

# the root window
root = tk.Tk()
# window geometry is width x height + x_offset + y_offset
root.geometry("400x150+80+30")

# 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
enter1.focus()

# 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
root.mainloop()
Be a part of the DaniWeb community

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