Python Forum
[Tkinter] How to add conversions and fix button positions.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] How to add conversions and fix button positions.
#1
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.

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()
Reply


Messages In This Thread
How to add conversions and fix button positions. - by javesike1262 - Jan-30-2021, 04:11 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] Programmatically creating buttons that remember their positions Clunk_Head 6 1,513 Jun-22-2023, 02:51 PM
Last Post: deanhystad
  [PySimpleGui] How to alter mouse click button of a standard submit button? skyerosebud 3 5,133 Jul-21-2019, 06:02 PM
Last Post: FullOfHelp
  GUI Tkinter Widget Positions punksnotdead 3 3,062 Jun-12-2019, 06:06 PM
Last Post: Yoriz

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020