def __init__(self): self._dbConnect=DBConnect() self._root=Tk() tv=ttk.Treeview(self._root) tv.pack() tv.heading("#0",text="ID") tv.configure(column=('Name','Gender','Comment')) tv.heading("Name",text="Full Name") tv.heading("Gender",text="Gender") tv.heading("Comment",text="Comment") cursor=self._dbConnect.ListTickets() 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"]) #print("ID:{},Name:{},Gender:{},Comment:{}".format(row["ID"],row["Name"],row["Gender"],row["Comment"])) self._root.mainloop()
from tkinter import * from tkinter import ttk from tkinter import messagebox from DbConnectClass import DBConnect dbconnect=DBConnect() root= Tk() ttk.Label(root,text="Full Name").grid(row=0,column=0) EntryFullName=ttk.Entry(root ,width=30,font=('Arial,10')) EntryFullName.grid(row=0,column=1,columnspan=2) root.configure(background='#e1d8b2') style=ttk.Style() style.theme_use('classic') style.configure('TLable',background='blue') style.configure('TButton',background='blue',foreground="white") style.configure('TRadiobutton',background='blue',foreground="white") SpanGender=StringVar() SpanGender.set('Male') ttk.Label(root,text="Gender").grid(row=1,column=0) ttk.Radiobutton(root,text="male",variable=SpanGender,value="Male").grid(row=1,column=1) ttk.Radiobutton(root,text="Female",variable=SpanGender,value="Female").grid(row=1,column=2) TextComments=Text(root,width=20,height=15,font=('Arial',16))
from tkinter import * from tkinter import ttk from tkinter import messagebox from DbConnectClass import DBConnect from ListReservation import ListTickets dbConnect=DBConnect() root=Tk() ttk.Label(root,text="Full name:").grid(row=0, column=0, pady=10,padx=10) EntryFullName=ttk.Entry(root, width=30, font = ('Arial', 16)) EntryFullName.grid(row=0, column=1,columnspan=2, pady=10) ttk.Label(root,text="ID").grid(row=1, column=0, pady=10,padx=10) EntryId=ttk.Entry(root, width=30, font = ('Arial', 16)) EntryId.grid(row=1, column=1,columnspan=2, pady=10) root.title("Ticket Reservation") #style root.configure(background="#e1d8b2") style=ttk.Style() style.theme_use("classic") style.configure("TLabel",background="#e1d8b2") style.configure("TButton",background="#e1d8b2") style.configure("TRadiobutton",background="#e1d8b2") SpanGender=StringVar() SpanGender.set("Male") ttk.Label(root,text="Gender").grid(row=2, column=0) ttk.Radiobutton(root,text="Male",variable=SpanGender, value="Male").grid(row=2, column=1) ttk.Radiobutton(root,text="Female",variable=SpanGender, value="Female").grid(row=2, column=2) TextComments=Text(root,width=30, height=15, font = ('Arial', 16)) TextComments.grid(row=4, column=1,columnspan=2) ttk.Label(root,text="Residence:").grid(row=3, column=0)