...
#
# File: ButtonClickEvent
# Date: Sept 4,2024
from tkinter import *
HMWindow =Tk()
HMWindow.geometry("500x500")
HMWindow.title("HMWindow, Date sept 4,2024")
HMdata =StringVar()
emptylabel=Label(HMWindow,fg='green')
emptylabel.grid(row=2,column=1,sticky=W,pady=10)
def HMPrint():
print("demo HMprint")
def HMExit():
exit()
def HMMyFunction():
emptylabel.config(text ="your Name:" +HMdata.get())
HMLabel1 =Label(HMWindow,text="HMLabel1")
HMLabel1.place(x=100,y=100)
HMLabel2 =Label(HMWindow,text="HMLabel2")
HMLabel2.place(x=100,y=140)
#..next
HMPB1 =Button(HMWindow,text ="HMPB1",width=20,command=HMPrint)
HMPB1.place(x=180,y=100)
HMPB2 =Button(HMWindow,text ="HMPB2 Exit",width=20,command=HMExit)
HMPB2.place(x=180,y=140)
#
HMLabel3 =Label(HMWindow,text="HMLabel3")
HMLabel3.grid(row=4, column=4, padx=5,pady=10)
HMTextBox1 =Entry(HMWindow,textvariable =HMdata)
HMTextBox1.grid(row=4,column=6)
#
HMPB3 =Button(HMWindow,text ="HMPB3 Exit",width=20,command=HMMyFunction)
HMPB3.place(x=240,y=180)
#
HMWindow.mainloop()
#
# File: ButtonClickEvent
# Date: Sept 4,2024
from tkinter import *
HMWindow =Tk()
HMWindow.geometry("500x500")
HMWindow.title("HMWindow, Date sept 4,2024")
def HMPrint():
print("demo HMprint")
def HMExit():
exit()
HMLabel1 =Label(HMWindow,text="HMLabel1")
HMLabel1.place(x=100,y=100)
HMLabel2 =Label(HMWindow,text="HMLabel2")
HMLabel2.place(x=100,y=140)
HMLabel3 =Label(HMWindow,text="HMLabel3")
HMLabel3.place(x=100,y=180)
#..next
HMPB1 =Button(HMWindow,text ="HMPB1",width=20,command=HMPrint)
HMPB1.place(x=180,y=100)
#
HMPB2 =Button(HMWindow,text ="HMPB2 Exit",width=20,command=HMExit)
HMPB2.place(x=180,y=140)
HMWindow.mainloop()
#File pyHMTKinter-1.py
#import customtkinter
import tkinter as tk
# Top level window
frame = tk.Tk()
frame.title("TextBox Input")
frame.geometry('400x200')
# Function for getting Input
# from textbox and printing it
# at label widget
def printInput():
inp = inputtxt.get(1.0, "end-1c")
lbl.config(text="Provided Input: " + inp)
# print next
def printNext():
inp = inputtxt.get(1.0, "end-1c")
lbl.config(text="Provided Input: " + inp)
# TextBox Creation
inputtxt = tk.Text(frame,
height=1,
width=20)
inputtxt.pack()
# Button Creation
printButton = tk.Button(frame,text="Print",command=printInput)
printButton.pack()
# next button
printButton_2 = tk.Button(frame,text="Print next",command=printNext)
printButton_2.place(relx=0.7,rely=0.3)
#printButton_2.pack()
# Label Creation
lbl = tk.Label(frame, text="")
lbl.pack()
frame.mainloop()