Mar-26-2022, 07:24 PM
well...thank you all for your help!! finally got it ! your tips helped me a lot!
would like to make an addition though...
as you can see,i get two values from my inputs (final centimeters and final liters)
is there any way to add a button that sums up some input that i will give in centimeters and the already calculated centimeters output?
thanks again!
(i attach the final code below)
would like to make an addition though...
as you can see,i get two values from my inputs (final centimeters and final liters)
is there any way to add a button that sums up some input that i will give in centimeters and the already calculated centimeters output?
thanks again!
(i attach the final code below)
import tkinter as tk def main(): window= tk.Tk() window.title(" ERRIKOS Converter") window.geometry("800x800") # create a label with text Enter centimetre label1 = tk.Label(window, text="gimme the centimetres: ") # create a label with text litres label2 = tk.Label(window, text="we have litres:") # place label1 in window at position x,y label1.place(x=50,y=30) # create an Entry widget (text box) textbox1 = tk.Entry(window, width=12) # place textbox1 in window at position x,y textbox1.place(x=200,y=35) # place label2 in window at position x,y label2.place(x=50,y=100) # create a label3 with empty text: label3 = tk.Label(window, text=" ") # place label3 in window at position x,y label3.place(x=180,y=100) def btn1_click(): litres = round(float(textbox1.get()) * 10) label3.configure(text = str(litres)+ ' litres') # create a button with text Button 1 btn1 = tk.Button(window, text="print litres", command=btn1_click) # place this button in window at position x,y btn1.place(x=90,y=150) # create a label with text Enter litres label4 = tk.Label(window, text="ordered litres: ") # create a label with text centimetres label5 = tk.Label(window, text="litres in centimetres: ") # place label4 in window at position x,y label4.place(x=50,y=730) # create an Entry widget (text box) textbox2 = tk.Entry(window, width=12) # place textbox2 in window at position x,y textbox2.place(x=200,y=735) # place label5 in window at position x,y label5.place(x=50,y=700) # create a label6 with empty text: label6 = tk.Label(window, text=" ") # place label6 in window at position x,y label6.place(x=180,y=700) def btn2_click(): centimetres = round(float(textbox2.get()) / 10) label6.configure(text = str(centimetres)+ ' centimetres') # create a button with text Button 2 btn2 = tk.Button(window, text="print centimetres", command=btn2_click) # place this button in window at position x,y btn2.place(x=90,y=750) window.mainloop() main()