the code is
from tkinter import * # Import tkinter
class ChangeLabel:
def __init__(self):
window = Tk() # Create a window
window.title("Change Label Demo") # Set a title
# Add a label to frame1
frame1 = Frame(window) # Create and add a frame to window
frame1.pack()
self.lbl = Label(frame1, text = "No distance entered yet")
self.lbl.pack()
# Add a label, an entry, and a button to frame2
frame2 = Frame(window) # Create and add a frame to window
frame2.pack()
label = Label(frame2, text = "Enter a distance in kilometres:")
self.msg = StringVar()
entry = Entry(frame2, textvariable = self.msg) # Create entry
btChangeText = Button(frame2, text = "Convert",
command = self.processButton) # Button callback method
label.grid(row = 1, column = 1)
entry.grid(row = 1, column = 2)
btChangeText.grid(row = 1, column = 3)
window.mainloop() # Create an event loop
def processButton(self):
calc = float(self.msg.get()) * 0.6214
self.lbl["text"] = self.msg.get(), "Kilometres is", "%.2f" %calc, "miles"
ChangeLabel() # Create GUI
in the out put when you put in a number the output says
"20 {kilometres is} 12.43 miles"
how do I remove the {}?