Jan-30-2021, 04:11 PM
Hi everybody, I have recently started learning to make Python Gui's using the Tkinter model. However, I need help with doing a conversion like this.
https://youtu.be/1z41yet2DkI
Here is what I have so far though it's not complete and the conversions are still missing and I have the combobox with the list of meters and feet.
https://youtu.be/1z41yet2DkI
Here is what I have so far though it's not complete and the conversions are still missing and I have the combobox with the list of meters and feet.
from tkinter import * from tkinter import ttk root = Tk() root.title("Length Converter") mainframe = ttk.Frame(root, padding= "25 25 25 25") mainframe.grid(column=0, row=0, sticky=(N, W, E, S)) root.columnconfigure(0, weight=1) root.rowconfigure(0, weight=1) meters = StringVar() feet = StringVar() n = StringVar() meters_entry = ttk.Entry(mainframe, width=7, textvariable=meters) meters_entry.grid(column=2, row=1, sticky=(W, E)) choices = ttk.Combobox (root, width = 10, textvariable = n) choices ['values'] = ('meters', 'feet') choices.grid(column = 1, row = 1) ttk.Label(mainframe, text="is equal to").grid(column=1, row=2, sticky=E) ttk.Button(mainframe, text="Calculate").grid(column=2, row=3, sticky=W) root.mainloop()