import tkinter as tk
# creates and runs an instance of the window
window = tk.Tk()#makes the size of the widow
window.geometry("600x400")#sets a title for the screen
window.title("intercode")# creating a new label and adding a text to the window
new_label=tk.Label(window,text='Enter your height in feet
')
new_label.pack()#creates a entrybox to add words to window
entry_label=tk.Entry(window)
entry_label.pack()# defines results as string var
results= tk.StringVar(window)#creating a results label
result_lable=tk.Label(window,textvariable=results)
result_lable.pack()defcallbackfunct():
height = entry_label.get()try:
height=float(height)except ValueError:
results.set("
Please Enter Number.")
converted_height=0.0606061*float(height)# rounds to decimal places
converted_height=round(converted_height,3)
results.set(f"
You are converted height |{converted_height}| tall.")print(f"inputs .*>|{converted_height}|<*. ")# deletes the text in the text box
entry_label.delete(0,tk.END)# creating a button with a command
buttonez = tk.Button(text="Submit", command=callbackfunct)
buttonez.pack()
window.mainloop()
from tkinter import*#This is a simple app with buttons#I hope you like it! :)
root = Tk()
root.geometry("400x400")
root.config(bg="gray")
root.
title ="Cool App"
root.title(" ")defDo():global title
Value = Placeholder.get()
title = Value
root.title(title)
Placeholder = Entry(root,font=("serif",14))
Placeholder.pack()
Placeholder.focus()
Settings = Button(root,text="Settings",font="14")
Settings.place(x=350,y=330)
EditName = Button(root,text="Edit this App Name",bg="blue",activebackground="blue",font=("serif",15),command=Do)
EditName.pack()
root.mainloop()
import tkinter as tk #import the tkinter module as tk
core = tk.Tk()#makes the core (or root)
mylabel = tk.Label(core, text="Hello world!")#makes a label
mylabel.grid(row=0, column=1)#places the object in a virtual grid
tk.Pack()#Pack the object(s)
core.mainloop()#Make the application a loop (needed)
Tkinter is used to create windows in python
from tkinter import*#import tkinter
window = Tk()#create the window
window.title("Title")#Set window title
window.geoemtry("400x400")#Adjusts window to 400x400px
window.mainloop()#Updates window