SQLite data in a Tkinter’s box

As you can see I created a home page with a button in first column to create new customer ID and insert some data.
In my code I made 3 tables in the same database to divide informations and than show up in a simpler way datas.

My idea is: in the home page you can see all customers informations from dataDBG_clienti (In a second time I would add a search box), thant you can double click on one customer and open a new window to add tansactions and store them in dataDBG_credit or dataDBG_debit in base of the kind of transaction is.

import tkinter as tk 
import tkinter
from tkinter import ttk
from tkinter import *
import tkinter.messagebox
import sqlite3
import sys

home = tk.Tk()
home.title("DBG - Cassaforte")
home.geometry("1280x720")
home_frame = tk.Frame(home)



columns = []
for i in range(2):
    frame = tk.Frame(home, borderwidth=1, relief="raised", background="white")
    columns.append(frame)

home.grid_rowconfigure(0, weight=1)
for column, f in enumerate(columns):
    f.grid(row=0, column=column, sticky="nsew")
    home.grid_columnconfigure(column, weight=1, uniform="column")

def open_newcustomerwindow():

    def enter_data():

        #informazioni cliente
        name = name_entry.get()
        surname = surname_entry.get()
        id = name+surname


        if name and surname:
            phone = phone_entry.get()
            email = email_entry.get()

            #informazioni credito
            creditamount = credit_amount_entry.get()
            creditmetod = credit_metod_combobox.get()

            #informazioni debito
            debitamount = debit_amount_entry.get()
            debitratenumber = debit_ratenumber_combobox.get()

            #connessione e creazione del database

            conn = sqlite3.connect('dataDBG.db')
            table_create_query = '''CREATE TABLE IF NOT EXISTS dataDBG_clienti
                (id TEXT, name TEXT, surname TEXT, phone INT, email TEXT)
                '''
            conn.execute(table_create_query)

            table_create_query = '''CREATE TABLE IF NOT EXISTS dataDBG_credit
                (id TEXT, creditamount NUMBER, creditmetod TEXT)
                '''
            conn.execute(table_create_query)

            table_create_query = '''CREATE TABLE IF NOT EXISTS dataDBG_debit
                (id TEXT, debitamount NUMBER, debitratenumber INT)
                '''
            conn.execute(table_create_query)
            

            #inserimento dati
            data_insert_query = '''INSERT INTO dataDBG_clienti
                (id, name, surname, phone, email) VALUES (?, ?, ?, ?, ?)'''
            data_insert_tuple = (id, name, surname, phone, email)
            cursor = conn.cursor()
            cursor.execute(data_insert_query, data_insert_tuple)
            conn.commit()
           

            data_insert_query = '''INSERT INTO dataDBG_credit
                (id, creditamount, creditmetod) VALUES (?, ?, ?)'''
            data_insert_tuple = (id, creditamount, creditmetod)
            cursor = conn.cursor()
            cursor.execute(data_insert_query, data_insert_tuple)
            conn.commit()
           
            
            data_insert_query = '''INSERT INTO dataDBG_debit
                (id, debitamount, debitratenumber) VALUES (?, ?, ?)'''
            data_insert_tuple = (id, debitamount, debitratenumber)
            cursor = conn.cursor()
            cursor.execute(data_insert_query, data_insert_tuple)
            conn.commit()
            conn.close()
            tkinter.messagebox.showinfo(title="Completato", message="Informazioni salvate correttamente")
            form_newcustomer.destroy()

         
        else:
            tkinter.messagebox.showwarning(title="Errore", message="Nome e/o Cognome non possono essere lasciati vuoti")

    form_newcustomer = tk.Toplevel(home)
    form_newcustomer.title("Nuovo Cliente")
    form_newcustomer_label = tk.Label(form_newcustomer, text="Inserire le informazioni sul nuovo Cliente")

    frame = tkinter.Frame(form_newcustomer)
    frame.pack()

    #informazioni cliente
    user_info_frame = tkinter.LabelFrame(frame, text="Informazioni Cliente")
    user_info_frame.grid(row= 0, column=0, padx=20, pady=20)

    #etichette campi Cliente
    name_label = tkinter.Label(user_info_frame, text="Nome")
    name_label.grid(row=0, column=0)
    surname_label = tkinter.Label(user_info_frame, text="Cognome")
    surname_label.grid(row=0, column=1)
    phone_label = tkinter.Label(user_info_frame, text="Telefono")
    phone_label.grid(row=2, column=0)
    email_label = tkinter.Label(user_info_frame, text="E-Mail")
    email_label.grid(row=2, column=1)

    #campi inserimento dati Cliente
    name_entry = tkinter.Entry(user_info_frame)
    surname_entry = tkinter.Entry(user_info_frame)
    phone_entry = tkinter.Entry(user_info_frame)
    email_entry = tkinter.Entry(user_info_frame)
   
    name_entry.grid(row=1, column=0)
    surname_entry.grid(row=1, column=1)
    phone_entry.grid(row=3, column=0)
    email_entry.grid(row=3, column=1)

    #informazioni credito
    credit_frame = tkinter.LabelFrame(frame, text="Credito")
    credit_frame.grid(row= 1, column=0, padx=20, pady=20)

    #etichette campi Credito
    credit_label = tkinter.Label(credit_frame, text="Importo")
    credit_label.grid(row=0, column=0)
    credit_metod_label = tkinter.Label(credit_frame, text="Metodo di pagamento")
    credit_metod_label.grid(row=0, column=1)

    #campi inserimento Credito
    credit_amount_entry = tkinter.Entry(credit_frame)
    credit_metod_combobox = ttk.Combobox(credit_frame, values=["Contanti","Carta","Bonifico","Permuta"])

    credit_amount_entry.grid(row=1, column=0)
    credit_metod_combobox.grid(row=1, column=1)

    #informazioni Debito
    debit_frame = tkinter.LabelFrame(frame, text="Rateizzazione")
    debit_frame.grid(row= 2, column=0, padx=20, pady=20)

    #etichette campi Debito
    debit_amount_label = tkinter.Label(debit_frame, text="Importo totale")
    debit_amount_label.grid(row=0, column=0)

    debit_ratenumber_label = tkinter.Label(debit_frame, text="Numero rate")
    debit_ratenumber_label.grid(row=0, column=1)

    #campi inserimento Debito
    debit_amount_entry = tkinter.Entry(debit_frame)
    debit_ratenumber_combobox = ttk.Combobox(debit_frame, values=["0","1","2","3","4","5","6","7","8","9","10","11","12"])


    debit_amount_entry.grid(row=1, column=0)
    debit_ratenumber_combobox.grid(row=1, column=1)

    #pulsante funzione salvataggio 
    button_frame = tkinter.LabelFrame(frame, text="")
    button_frame.grid(row= 3, column=0, padx=20, pady=20)
    save_button = tkinter.Button(button_frame, text="Salva", command=enter_data)
    save_button.grid(row=0, column=2)



    #allineamento widget

    for widget in user_info_frame.winfo_children():
        widget.grid_configure(padx=10, pady=5)

    form_newcustomer.mainloop()

Button(home, text="Aggiungi nuovo cliente",command=open_newcustomerwindow).grid(row=0, column=0)



home.mainloop()

Now I would fill the second column with a database database’s table.
How can I do that?

New contributor

Raffaele Allocca is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật