Example #1
0
    def __init__(self, Date):
        self._root = Tk()
        self._dbconnect = DBConnect()
        self._root.title('Liste')
        style = ttk.Style()
        Dbtn = ttk.Button(self._root, text="Delet", state='disabled')
        tv = ttk.Treeview(self._root)
        tv.pack()
        tv.heading('#0', text="Nom")
        tv.configure(column=('#Gender', '#Prix', '#Note'))
        tv.column('#Gender', width=70, anchor='center')
        tv.column('#Prix', width=70, anchor='center')
        tv.column('#0', width=150, anchor='center')
        tv.column('#Note', width=400, anchor='center')
        tv.heading('#Gender', text="Gender")
        tv.heading('#Prix', text="Prix")
        tv.heading('#Note', text="Note")
        cursor = self._dbconnect.ListRequest(Date)
        toutl = 0
        for row in cursor:
            tv.insert('', '0', '#{}'.format(row['ID']), text=row['Nom'])
            tv.set('#{}'.format(row['ID']), '#Gender', row['Gender'])
            tv.set('#{}'.format(row['ID']), '#Prix', row['Prix'])
            tv.set('#{}'.format(row['ID']), '#Note', row['Note'])
            if row['Gender'] == "Vente":
                prix = int(row['Prix'])
                toutl += prix
            else:
                prix = -int(row['Prix'])
                toutl += prix
        print(toutl)

        def Selectitem(event):
            Dbtn.state(['!disabled'])

        def Delet():
            id = tv.selection()
            _id = id[0]
            __id = ""
            for i in range(len(_id)):
                if i != 0:
                    __id += _id[i]
            msg = dbconnect.DeletRecord(__id)
            tv.delete(_id)
            messagebox.showinfo("Delet Info", msg)
            Dbtn.state(['disabled'])

        # label t
        txt = "Total : " + str(toutl) + " Dinar"
        Tl = Label(self._root, text=txt)
        Tl.pack()

        Dbtn.configure(command=Delet)
        tv.bind('<<TreeviewSelect>>', Selectitem)
        Dbtn.pack(pady=5)

        self._root.mainloop()
Example #2
0
    def __init__(self):
        self._root = Tk()
        self._root.title('List Request')
        self._root.resizable(0, 0)
        self._root.configure(background="#e1d8b2")

        #Tree View
        self._frame = ttk.Frame(self._root, width=300, height=100)
        self._frame.grid(row=0, column=0, columnspan=3)
        self._dbconnect = DBConnect()
        tv = ttk.Treeview(self._frame)
        tv.pack()
        tv.heading('#0', text='ID')
        tv.configure(column=('#Name', '#Gender', '#Comment'))
        tv.heading('#Name', text='Name')
        tv.heading('#Gender', text='Gender')
        tv.heading('#Comment', text='Comment')
        # style
        style = ttk.Style()
        style.theme_use('clam')
        style.configure('TLabel', background="#e1d8b2")
        style.configure('TButton', background="#e1d8b2")

        buDelete = ttk.Button(self._root, text="Delete Record")
        buDelete.grid(row=0, column=3, pady=10)

        buUpdate = ttk.Button(self._root, text="Update Record")
        buUpdate.grid(row=1, column=3, pady=10)

        cursor = self._dbconnect.ListRequest()

        for row in cursor:
            tv.insert('', 'end', '#{}'.format(row['ID']), text=row['ID'])
            tv.set('#{}'.format(row['ID']), '#Name', row['Name'])
            tv.set('#{}'.format(row['ID']), '#Gender', row['Gender'])
            tv.set('#{}'.format(row['ID']), '#Comment', row['Comment'])

        def BuDelete():
            #print('Hello Delete')
            deleterecord = Deleterecord()
            #msg=dbconnect.DeleteRecord(DeleteRecord.BuDelete())
            #messagebox.showinfo(title="Delete info", message=msg)

        def BuUpdate():
            #print("hello update")
            updaterecord = Updaterecord()
            #msg = dbconnect.UpdateRecord(row['ID'], row['Comment'])
            #messagebox.showinfo(title="Update info", message=msg)

        buDelete.config(command=BuDelete)
        buUpdate.config(command=BuUpdate)

        self._root.mainloop()
class ListTicket:
    def __init__(self):
        self._root = Tk()
        #butDelete = ttk.Button(self._root,text = "Delete")
        #butDelete.pack()
        #butDelete.grid(row=0,column = 0 )

        #butUpdate = ttk.Button(self._root,text = "Update")
        #butUpdate.pack()
        #butUpdate.grid(row=1,column = 0 )

        self._dbconnect = DBConnect()
        tv = ttk.Treeview(self._root)
        tv.pack()
        tv.heading('#0', text='ID')
        tv.configure(column=('#Name', '#Gender', '#Comment'))
        tv.heading('#Name', text='IName')
        tv.heading('#Gender', text='Gender')
        tv.heading('#Comment', text='Comment')
        cursor = self._dbconnect.ListRequest()
        for row in cursor:
            tv.insert('', 'end', '#{}'.format(row['ID']), text=row['ID'])
            tv.set('#{}'.format(row['ID']), '#Name', row['Name'])
            tv.set('#{}'.format(row['ID']), '#Gender', row['Gender'])
            tv.set('#{}'.format(row['ID']), '#Comment', row['Comment'])
Example #4
0
    def __init__(self):
        self._root = Tk()
        self._dbConnect = DBConnect()
        tv = ttk.Treeview(self._root)
        tv.pack()
        tv.heading('#0', text='ID')
        tv.configure(column=('#Name', '#Gender', '#Comment'))
        tv.heading('#Name', text='Name')
        tv.heading('#Gender', text='Gender')
        tv.heading('#Comment', text='Comment')

        cursor = self._dbConnect.ListRequest()
        for row in cursor:
            tv.insert('', 'end', '#{}'.format(row['ID']), text=row['ID'])
            tv.set('#{}'.format(row['ID']), '#Name', row['Name'])
            tv.set('#{}'.format(row['ID']), '#Gender', row['Gender'])
            tv.set('#{}'.format(row['ID']), '#Comment', row['Comment'])

        self._root.mainloop()
Example #5
0
from tkinter import *
from tkinter import ttk
from DbConnect import DBConnect
from DeleteRecord import Deleterecord
from UpdateRecord import Updaterecord

dbconnect = DBConnect()


class ListTicket:
    def __init__(self):
        self._root = Tk()
        self._root.title('List Request')
        self._root.resizable(0, 0)
        self._root.configure(background="#e1d8b2")

        #Tree View
        self._frame = ttk.Frame(self._root, width=300, height=100)
        self._frame.grid(row=0, column=0, columnspan=3)
        self._dbconnect = DBConnect()
        tv = ttk.Treeview(self._frame)
        tv.pack()
        tv.heading('#0', text='ID')
        tv.configure(column=('#Name', '#Gender', '#Comment'))
        tv.heading('#Name', text='Name')
        tv.heading('#Gender', text='Gender')
        tv.heading('#Comment', text='Comment')
        # style
        style = ttk.Style()
        style.theme_use('clam')
        style.configure('TLabel', background="#e1d8b2")
Example #6
0
from tkinter import *
from tkinter import *
from DbConnect import DBConnect

dbConnect = DBConnect()


class ListTicket:
    def __init__(self):
        self._root = Tk()
        self._dbConnect = DBConnect()
        tv = ttk.Treeview(self._root)
        tv.pack()
        tv.heading('#0', text='ID')
        tv.configure(column=('#Name', '#Gender', '#Comment'))
        tv.heading('#Name', text='Name')
        tv.heading('#Gender', text='Gender')
        tv.heading('#Comment', text='Comment')

        cursor = self._dbConnect.ListRequest()
        for row in cursor:
            tv.insert('', 'end', '#{}'.format(row['ID']), text=row['ID'])
            tv.set('#{}'.format(row['ID']), '#Name', row['Name'])
            tv.set('#{}'.format(row['ID']), '#Gender', row['Gender'])
            tv.set('#{}'.format(row['ID']), '#Comment', row['Comment'])

        self._root.mainloop()