I am very new to python and tkinter. I am trying to build the below GUI interface which is a skincare program that will recommend products based on the result of picking from the 4 drop-down menus. The last button - help will bring up contact info.
I am at the very beginning stages and cannot get the first option menu for age to appear. Could anyone explain the reason for this please and how do I make it so that the combination of answers for Age, Skin Type, Main Skin Concern and Clean Beauty result in products recommended due to the combination?
import tkinter as tk
age_menu = [
"<=18",
"19 - 25",
"25 - 34",
"35 - 45"
]
# root window
root = tk.Tk()
root.geometry("800x500")
root.title("SAVE MY SKIN")
root.configure(bg = "#32402f")
greeting = tk.Label(root, text = "Hello!", fg = "#faf2e9",
bg = "#32402f",font = ("Courier",20,"bold"),
anchor = "w", width = 60, padx = 30,
pady = 40
).grid(row = 0, column = 0, sticky = tk.W)
instructions = tk.Label(root, text="Fill in your details to get
a list of product recommendations "
"perfect for your specific "
"skincare needs!",fg = "#faf2e9",
bg = "#32402f",
wraplength = 300, justify = "left",
font = ("Courier",20), anchor = "w",
width = 60, padx = 30, pady = 20
).grid(row = 1, column = 0,
sticky = tk.W)
disclaimer = tk.Label(root,text = "This is not intended as a
subsititute "
"for professional medical advice and should not be "
"relied on as health or personal advice. Always seek "
"the guidance of your doctor or other qualified health "
"professional with any questions you may have "
"regarding your health or a medical condition.",
fg = "#faf2e9", bg = "#32402f", wraplength = 500,
justify = "left",font = ("Helvetica Neue",10),
anchor = "w", width = 100, padx = 30, pady = 180
).grid(row = 2, column = 0, sticky = tk.W)
var = tk.StringVar()
var.set("Age")
ageclicked = tk.OptionMenu(root,var,*age_menu)
ageclicked.config(fg = "#faf2e9", bg = "#32402f",width = 90,
font = ("Helvetica",12), anchor = "e")
ageclicked.grid(row = 2,column = 1)
root.mainloop()
CodePudding user response:
So the first issue I had was with formatting so I rewrote it to follow