So Im creating a software for my mom and i want to resize a button here is my code:
from tkinter import *
from tkinter.ttk import *
class Client():
def __init__(self):
self.name = ""
self.last_name = ""
self.full_name = ""
self.birth_date = ""
self.email = ""
self.phone_number = ""
def set_Properties(self, name, last_name, birth_date, email, phone_number):
self.name = name
self.last_name = last_name
self.full_name = f"{name} {last_name}"
self.birth_date = birth_date
self.email = email
self.phone_number = phone_number
def main():
root = Tk()
root.title("client Manager")
root.resizable(width=False, height=False)
global grid_list
grid_list = []
name_label = Label(root, text = "First name")
lastName_label = Label(root, text = "Last name")
birthDate_label = Label(root, text = "Birth date")
email_label = Label(root, text = "Email")
phoneNumber_label = Label(root, text = "Phone namber")
name_entry = Entry(root)
lastName_entry = Entry(root)
birthDate_entry = Entry(root)
email_entry = Entry(root)
phoneNumber_entry = Entry(root)
clients = {}
clients_labels = {}
global numbering
numbering = 0
def finish():
full_name = f"{name_entry} {lastName_entry}"
clients[full_name] = Client()
clients[full_name].set_Properties(name_entry.get(), lastName_entry.get(), birthDate_entry.get(), email_entry.get(), phoneNumber_entry.get())
global numbering
clients_labels[numbering] = Label(root, text = f"Name: {clients[full_name].full_name} | Email: {clients[full_name].email} | Birth date: {clients[full_name].birth_date} | Phone number: {clients[full_name].phone_number}")
numbering += 1
global grid_list
for i in grid_list:
i.grid_forget()
grid_list = []
x = 0
for i in clients_labels:
clients_labels[i].grid(row=x, column=1, padx=10, pady=5)
grid_list.append(clients_labels[i])
x+=1
add_button.grid(row=x, column=0, padx=20, pady=20)
grid_list.append(add_button)
def add():
global grid_list
for i in grid_list:
i.grid_forget()
grid_list = []
# setting up the add text
name_label.grid(row=0, column=0, padx=10, pady=5)
grid_list.append(name_label)
lastName_label.grid(row=1, column=0, padx=10, pady=5)
grid_list.append(lastName_label)
birthDate_label.grid(row=2, column=0, padx=10, pady=5)
grid_list.append(birthDate_label)
email_label.grid(row=3, column=0, padx=10, pady=5)
grid_list.append(email_label)
phoneNumber_label.grid(row=4, column=0, padx=10, pady=5)
grid_list.append(phoneNumber_label)
# setting up the add entry
name_entry.grid(row=0, column=1, padx=10, pady=5)
grid_list.append(name_entry)
lastName_entry.grid(row=1, column=1, padx=10, pady=5)
grid_list.append(lastName_entry)
birthDate_entry.grid(row=2, column=1, padx=10, pady=5)
grid_list.append(birthDate_entry)
email_entry.grid(row=3, column=1, padx=10, pady=5)
grid_list.append(email_entry)
phoneNumber_entry.grid(row=4, column=1, padx=10, pady=5)
grid_list.append(phoneNumber_entry)
# setting up the finish button
finish_button.grid(row=5, column=0, padx=10, pady=5)
grid_list.append(finish_button)
add_button = Button(root, text="Add", command=add)
finish_button = Button(root, text="finish", command=finish)
add_button.grid(row=0, column=0, padx=20, pady=20)
grid_list.append(add_button)
root.mainloop()
main()
and i need a better why to make the program looks good maybe a theme or something can you add tables to tkinter?
https://www.delftstack.com/howto/python-tkinter/how-to-change-the-tkinter-button-size/ thet here didnt helped me.
Im working with themed python Can anyone help me?