0

exchange office program

Hi! I have to code in python exchange office program, creating label with two plus two rows and four columns, like this: from tkinter import* def change (): input=int(entry.get()) input=input*1/120 оutput_label.configure(text = 'Euros: {:.1f}'.format(input)) entry.delete(0,END) root = Tk() message_label = Label(text='Input amount in rsd',font=('Verdana', 16)) оutput_label = Label(font=('Verdana', 16)) entry = Entry(font=('Verdana', 16), width=8) calc_button = Button(text='Change', font=('Verdana', 16),command=change) message_label.grid(row=0, column=0) entry.grid(row=0, column=1) calc_button.grid(row=0, column=2) оutput_label.grid(row=1, column=0, columnspan=3) #mainloop() when mainloop is witout hashtag work changing into dinars only, def promeni (): input=int(entry.get()) input=input*120 оutput_label.configure(text = 'Dinars: {:.1f}'.format(input)) entry.delete(0,END) message_label = Label(text='Input amount in Euros',font=('Verdana', 16)) оutput_label = Label(font=('Verdana', 16)) entry = Entry(font=('Verdana', 16), width=8) calc_button = Button(text='Change', font=('Verdana', 16),command=change) message_label.grid(row=2, column=0) entry.grid(row=2, column=1) calc_button.grid(row=2, column=2) оutput_label.grid(row=3, column=0, columnspan=3) mainloop() #this way everything is visible but when I put amount in dinars python reports literal error Could anyone help me with this? Thx a lot!

26th Sep 2018, 6:40 AM
dr POP
dr POP - avatar
2 Antworten
+ 1
maybe locale can help? https://docs.python.org/3/library/locale.html
26th Sep 2018, 6:58 PM
Steven M
Steven M - avatar
0
what does {:.1f} mean in line оutput_label.configure(text = 'Euros: {:.1f}'.format(input))
2nd Oct 2018, 9:21 AM
dr POP
dr POP - avatar