def dialog_box():
    root = tk.Tk()
    root.title('Calendar')
    Label(root, text = 'Year').grid(row = 0)
    e1 = Entry(root)
    e1.grid(row = 0, column = 1)
    button = tk.Botton(root, text = 'Show', width = 20).grid(row = 1, column = 1)
    button.pack()
    root.mainloop()
Ejemplo n.º 2
0
	def createBottoms(self):
		self.btn = tk.Botton(self, 
							 text='File',
							 font=('Arial', 12),
							 width=3,
							 height=1,
							 command=self.)
		self.file_option_list = ("File open", "Save as", "Quit")
		self.file_option_var = tk.StringVar()
		self.file_option_var.set("File")
		self.file_option_menu = tk.OptionMenu(self, 
											  self.file_option_var, 
											 *self.file_option_list) 
		self.file_option_menu.grid(row=5, column=0, sticky=tk.N+tk.W)
		
		self.bottom_frame = tk.Frame(self)
		self.bottom_frame.pack(side=tk.BOTTOM)
Ejemplo n.º 3
0
def clickFunction():
    e2.delete(0,END)
    number = e1.get()
    number2 = e3.get()
    number3 = e4.get()
    text1="My name is"
    text2=", and I am a"
    text3=". I like"
    a=str(text1+number+text2+number2+text3+number3)
    e2.insert(0,a)

l1=tk.Label(win,text="My name is")
l2=tk.Label(win,text=+", and I am a")
L3=tk.Label(win,text=". I like")

b1 = tk.Botton(win, text="Click to enter",command=clickFunction)
e1=tk.Entry(win,width=20)
e2=tk.Entry(win, width=120, textvariable=eoutput)

e3=tk.Entry(win,width=20)
e4=tk.Entry(win,width=20)

l1.grid(row=1,column=1)
l2.grid(row=1,column=3)
L3.grid(row=1,column=5)
e1.grid(row=1,column=2)
e3.grid(row=1,column=4)
e4.grid(row=1,column=6)
b1.grid(row=2,column=1,columnspan=3)
e2.grid(row=3,column=1,columnspan=6)
root = tkinter.Tk()
root.title("Temperature Converter")


def f_to_c():
    f_value = int(fahrenheitValue.get())
    c_value = 5 / 9 * (f_value - 32)
    celsiusValue.set(str(c_value))


fahrenheitLabel = tkinter.Label(root, text="Fahrenheit:")
fahrenheitLabel.grid(column=1, row=1)

fahrenheitValue = tkinter.StringVar()
celsiusValue = tkinter.StringVar()

celsiusLabel = tkinter.Label(root, text="Celsius:")
celsiusLabel.grid(column=1, row=2)

fahrenheitEntry = tkinter.Entry(root, textvariable=fahrenheitValue)
fahrenheitEntry.grid(column=2, row=1)

resultLabel = tkinter.Label(root, textvariable=celsiusValue)
resultLabel.grid(column=2, row=2, sticky="W")

convert_botton = tkinter.Botton(root, text="Convert", command=f_to_c())
convert_botton.grid(row=3, column=1, colunmspan=2)

root.mainloop()
Ejemplo n.º 5
0
import tkinter as tk

window = tk.Tk()
window.title ('My window')
window.geometry('200x100')

l = tk.Label(window,text = 'OMG! This is TK!',bg = 'green',font = ('Arial',12),width=15,
             height=2)
l.pack()

b = tk.Botton(window,text='hit me')

window.mainloop()
Ejemplo n.º 6
0
import tkinter as tk

window = tk.Tk()
window.title("my window")
window.geometry('200x100')

# Label
var = tk.StringVar()
l = tk.Label(window,
             text='Test_Label',
             textvariable=var,
             bg='green',
             font=('Arial', 12),
             width=15,
             height=2)
l.pack()

# button
b = tk.Botton(window, test='hit me', width=15, height=2, command=hit_me)
window.mainloop()