I need help make the code work because the button isn't working properly and I need to find a way to put the input bar back into the the the code for the button to work and if you find anything to improve the code then that could be good to. Here is the code which I'm having trouble with:
from tkinter import *
from tkinter import ttk
root = Tk()
label = ttk.Label(root, text = 'Hello and welcome, Im the Height Calculator')
label.pack()
label.config(foreground = 'black', background = 'light grey')
label.config(font = ('Comic Sans', 12, 'bold'))
label = ttk.Label(root, text = '')
label.pack()
label.config(foreground = 'black', background = 'light grey')
label.config(font = ('Comic sans', 12, 'bold'))
label = ttk.Label(root, text = 'What is your height (in cm)?')
label.pack()
label.config(foreground = 'black', background = 'light grey')
label.config(font = ('Comic Sans', 12, 'bold'))
def height():
entry = ttk.Entry(root, width = 30)
entry.pack()
def height2():
messagebox.showinfo("You are", height + "cm tall")
top = Tk()
top.geometry("200x100")
b = Button(top,text = "Calculate",command = height2, activeforeground = "red",activebackground = "black",pady=10)
b.pack(side = BOTTOM)
top.mainloop()
Aucun commentaire:
Enregistrer un commentaire