def showdata(): a=py.password(text='ENTER THE PASSWORD TO ACCESS THE DATA BASE',title='ACCESS',default='',mask='*',root=root) print(a) if a=='anmol': conn=s.connect('wadali.db') cur=conn.cursor() cur.execute('SELECT * FROM jeweller1') ans=cur.fetchall() #print(type(ans[0])) for i in ans: print(i) p=messagebox.showinfo('DATA',str(ans)) top=Toplevel(root) top.config(background='grey') top.geometry('600x600+800+300') top.resizable(width=False,height=False) top.title('BILLING SYSTEM') search=Label(top,text='SEARCH BY ',bg='green',fg='orange',font=('bold',15)) search.place(x=50,y=50) l1=['DATE','NAME'] combo=cb(top,value=l1,width=30) combo.set('SELECT TYPE') combo.place(x=250,y=50) enter=Label(top,text='ENTER THE NAME/DATE:- ',bg='green',fg='orange',font=('bold',15)) enter.place(x=50,y=100) enter1=Entry(top,width=30) enter1.place(x=250,y=100) else: messagebox.showerror('FAILURE','SORRY PERMISSION TO ACCESS DATABASE IS DENIED') exit()
root.geometry("1200x720+120+120") root.mainloop() #%% COMBOBOX from tkinter import * from tkinter.ttk import Combobox as cb root = Tk() def print_me(): value = combo2.get() print(value) v = ['c++', 'c#', 'python'] combo = cb(root, values=v, width=15, height=20) combo.set('languages') combo.pack() #EXAMPLE date = list(range(1, 32)) combo2 = cb(root, values=date, width=15, height=20) combo2.set('select date') combo2.pack() button = Button(root, text='print', command=print_me).pack() root.geometry("1200x720+120+120") root.mainloop() #%% FONTS from tkinter import * from tkinter.font import Font as f from tkinter import font
def searchoption(): global label2, labelName, entryName, labelDate, month, year, search, tv, top, namecount, nameSearchButton, entryNameDate, dateSearch, datecount print(search.get()) if search.get() == "ALL": if nameSearchButton != '': nameSearchButton.place_forget() nameSearchButton = '' if dateSearch != '': dateSearch.place_forget() dateSearch = '' if labelName != '': labelName.place_forget() labelName = '' if entryNameDate != '': entryNameDate.place_forget() entryNameDate = '' if entryName != "": entryName.place_forget() entryName = "" if year != '': year.place_forget() year = '' if month != '': month.place_forget() month = '' if labelDate != '': labelDate.place_forget() labelDate = '' #frm.pack(side=tk.LEFT,fill=tk.X) #frm.pack(side=tk.TOP,padx=20) """ if namecount!='': namecount.place_forget() namecount='' if datecount!='': datecount.place_forget() datecount='' """ tv.delete(*tv.get_children()) f = open('data.csv', 'r') w = f.read() e = w.split('\n\n') l = [] count = 0 for i in e: if i != '' or i != ' ' or i != '\n': r = i.split(',') l.append(r) count += 1 l.pop(0) #remove the first row for i in l: if i != '': tv.insert("", 'end', values=i) #label2=Label(top,text='TOTAL NUMBER OF ENTRIES - '+str(count),bg='green',fg='orange') #label2.place(x=200,y=200) messagebox.showinfo("ENTRIES COUNT", 'TOTAL NUMBER OF ENTRIES - ' + str(len(l))) search.set("CHOOSE OPTION") elif search.get() == 'NAME': print('NAME') if year != '': year.place_forget() year = '' if month != '': month.place_forget() month = '' if labelDate != '': labelDate.place_forget() labelDate = '' if dateSearch != '': dateSearch.place_forget() dateSearch = '' tv.delete(*tv.get_children()) labelName = Label(top, text='Enter The Name of Waiter To Search:', bg='green', fg='orange') labelName.place(x=220, y=150) f = open('waiter_names.csv', 'r') cf = f.read() e = cf.split('\n') e.remove('WAITER_NAMES') f.close() wat = [i for i in e if i != ''] entryName = cb(top, value=wat, width=25) entryName.set('SELECT WAITER FROM LIST') entryName.place(x=500, y=150) #entryName=Entry(top,width=25) #entryName.place(x=500,y=150) nameSearchButton = Button(top, text='Search', command=searchByName) nameSearchButton.place(x=800, y=150) #place_forget()--to remove any widget #b = Button(root, text="Delete me", command=lambda: b.pack_forget()) #b.pack() elif search.get() == 'DATE': tv.delete(*tv.get_children()) if nameSearchButton != '': nameSearchButton.place_forget() nameSearchButton = '' if entryName != '': entryName.place_forget() entryName = '' if labelName != '': labelName.place_forget() labelName = '' """if label2!='': label2.place_forget() label2='' if namecount!='': namecount.place_forget() namecount='' """ labelDate = Label(top, text='ENTER NAME & DATE:- ', bg='green', fg='orange') labelDate.place(x=220, y=150) f = open('waiter_names.csv', 'r') cf = f.read() e = cf.split('\n') f.close() e.remove('WAITER_NAMES') wat = [i for i in e if i != ''] entryNameDate = cb(top, value=wat, width=25) entryNameDate.set('SELECT WAITER FROM LIST') entryNameDate.place(x=220, y=200) e = { 'JANUARY': '01', 'FEBRUARY': '02', 'MARCH': '03', 'APRIL': '04', 'MAY': '05', 'JUNE': '06', 'JULY': '07', 'AUGUST': '08', 'SEPTEMBER': "09", 'OCTOBER': "10", 'NOVEMBER': '11', 'DECEMBER': '12' } month = cb(top, value=list(e.keys()), width=25) month.set('SELECT MONTH') month.place(x=500, y=150) l = ['2020', '2021', '2022', '2023', '2024', '2025'] year = cb(top, value=l, width=25) year.set('SELECT YEAR') year.place(x=500, y=200) dateSearch = Button(top, text='Search', command=searchByDateName) dateSearch.place(x=800, y=200) else: tv.delete(*tv.get_children()) """ if label2!='': label2.place_forget() label2='' if labelName!='': labelName.place_forget() labelName='' if entryName!='': entryName.place_forget() entryName='' if year!='': year.place_forget() year='' if month!='': month.place_forget() month='' if labelDate!='': labelDate.place_forget() labelDate='' if namecount!='': namecount.place_forget() namecount='' if nameSearchButton!='': nameSearchButton.place_forget() nameSearchButton='' if entryNameDate!='': entryNameDate.place_forget() entryNameDate='' if dateSearch!='': dateSearch.place_forget() dateSearch='' if datecount!='': datecount.place_forget() datecount=''""" messagebox.showinfo("PROBLEM!!", "You have not Choosen any option!!!")
font=('', 20)) label2.pack() #Button(root, text='REFRESH', command=date).place(x=250,y=250) label3 = Label(root, text='RESORT NAME', bg='black', fg='red') label3.place(x=65, y=210) #l=pd.read_csv('resort_names.csv') #l=l['RESORT_NAMES'].tolist() #print(s['RESORT_NAMES'].tolist()) f = open('resort_names.csv', 'r') cf = f.read() e = cf.split('\n') e.remove('RESORT_NAMES') f.close() e = [i for i in e if i != ''] c1 = cb(root, value=e, width=25) c1.set('SELECT RESORT') c1.place(x=250, y=210) #Date of function label4 = Label(root, text='DATE FOR FUNCTION', bg='black', fg='red') label4.place(x=65, y=250) Button(root, text='SET DATE FOR THE FUNCTION', command=date).place(x=250, y=250) #captain name label5 = Label(root, text='CAPTAIN NAME', bg='black', fg='red') label5.place(x=65, y=310) #cap=pd.read_csv('captain_names.csv') #cap=cap['CAPTAIN_NAMES'].tolist() #cap.append('NONE')
txt_state.set(True) txt = Checkbutton(window, text='TXT', var=txt_state) txt.grid(column=0, row=6) jpg_state = BooleanVar() jpg_state.set(True) jpg = Checkbutton(window, text='JPG', var=jpg_state) jpg.grid(column=1, row=5) png_state = BooleanVar() png_state.set(True) png = Checkbutton(window, text='PNG', var=txt_state) png.grid(column=1, row=6) level_text = Label(window, text="Выбор уровней копирования", font=("Arial Bold", 10)) level_text.grid(column=0, row=7) copy_level = cb(window) copy_level['values'] = (1, 2, 3) copy_level.current(0) copy_level.grid(column=1, row=7) btn_check = Button(window, text="Проверить", bg="grey", fg="white", command=check_files) btn_check.grid(column=0, row=8) window.mainloop()
def show(): global tv, search, top, s1, alphaSearch, sort_alphabets, entryname, nameSearch if search.get() == "ALL": if sort_alphabets != '': sort_alphabets.grid_forget() sort_alphabets = '' if alphaSearch != '': alphaSearch.grid_forget() alphaSearch = '' if nameSearch != '': nameSearch.grid_forget() nameSearch = '' if entryname != "": entryname.grid_forget() entryname = '' tv.delete(*tv.get_children()) df = pd.read_csv("details.csv") data = df.dropna(axis=0, how='any') l = data.values.tolist() for i in l: if i != '': tv.insert("", 'end', values=i) messagebox.showinfo("ENTRIES COUNT", 'TOTAL NUMBER OF ENTRIES - ' + str(len(l))) elif search.get() == 'ALPHABETICALLY': print('hello') if nameSearch != '': nameSearch.grid_forget() nameSearch = '' if entryname != '': entryname.grid_forget() entryname = '' alphabet = [chr(97 + i) for i in range(26)] sort_alphabets = cb(s1, value=alphabet, width=25) sort_alphabets.set('SELECT ALPHABETS TO SHOW') sort_alphabets.grid(row=4, column=3) alphaSearch = Button(s1, width=15, fg='blue', activeforeground='black', text='SHOW BY LETTER', command=alphashow) alphaSearch.grid(row=6, column=3) elif search.get() == 'NAME': if sort_alphabets != '': sort_alphabets.grid_forget() sort_alphabets = '' if alphaSearch != '': alphaSearch.grid_forget() alphaSearch = '' entryname = Entry(s1, width=25, font=('arial', 14, 'bold'), bg="white") entryname.grid(row=4, column=3) entryname.insert(0, 'ENTER PARTY NAME!!!!') nameSearch = Button(s1, width=15, fg='green', activeforeground='black', text='SHOW BY NAME', command=nameshow) nameSearch.grid(row=6, column=3) search.set("SELECT OPTION SEARCH") else: if sort_alphabets != '': sort_alphabets.grid_forget() sort_alphabets = '' if alphaSearch != '': alphaSearch.grid_forget() alphaSearch = '' if nameSearch != '': nameSearch.grid_forget() nameSearch = '' if entryname != '': entryname.grid_forget() entryname = '' search.set("CHOOSE OPTION")
c1.set('SELECT THE FOOD ITEM') def additem(): print('item added') root=Tk() root.geometry('500x500') root.title('bill system') label=Label(root,text='food resturant') label.pack() label1=Label(root,text='food item') label1.place(x=65,y=110) l=['a','b','c','d','e'] c1=cb(root,value=l,width=25) c1.place(x=250,y=120) label2=Label(root,text='Quantity') label2.place(x=65,y=165) l1=list(range(1,101)) c2=cb(root,value=l1,width=25) c2.set('select quantity') c2.place(x=250,y=170) label3=Label(root,text='price') label3.place(x=65,y=220) e3=Entry(root,width=25)
l2.grid(row=8, column=6) label3 = Label(window, text='PHONE NO', bg='BLACK', fg='white') label3.grid(row=12, column=4) l3 = Entry(window, width=25) l3.grid(row=12, column=6) label4 = Label(window, text='No OF DAYS', bg='BLACK', fg='white') label4.grid(row=16, column=4) l4 = Entry(window, width=25) l4.grid(row=16, column=6) label5 = Label(window, text='ROOM TYPE', bg='BLACK', fg='white') label5.grid(row=20, column=4) l = ['KING', '1 BHK', 'DELUX', 'HONEYMOON', 'ANY OTHER TYPE'] c1 = cb(window, value=l, width=25) c1.set('SELECT ROOM TYPE') c1.grid(row=20, column=6) q = StringVar() label6 = Label(window, text='AMOUNT ', bg='BLACK', fg='white') label6.grid(row=24, column=4) l5 = Entry(window, textvariable=q, width=25) l5.grid(row=24, column=6) amount = Button(window, text='CALCULATE', width=20, bg='green', fg='orange') amount.grid(row=24, column=8) b1 = Button(window, text='VIEW ALL', width=20, bg='green', fg='orange',