DeukausGames

software da padaria

May 20th, 2019
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 5.74 KB | None | 0 0
  1. from tkinter import*
  2. from tkinter import messagebox
  3. import sqlite3
  4.  
  5. connP = sqlite3.connect('banco de dados/pessoas.db')
  6. connC = sqlite3.connect('banco de dados/codigos.db')
  7. pessoasDB = connP.cursor()
  8. codigosDB = connC.cursor()
  9.  
  10. pessoasDB.execute("""
  11. CREATE TABLE IF NOT EXISTS pessoas (
  12.     id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  13.     usuario TEXT NOT NULL,
  14.     senha TEXT NOT NULL
  15. );
  16. """)
  17.  
  18. codigosDB.execute("""
  19.     CREATE TABLE IF NOT EXISTS produtos (
  20.     codigo INTEGER(12) NOT NULL PRIMARY KEY,
  21.     nomeProduto TEXT NOT NULL,
  22.     codigoProduto TEXT NOT NULL,
  23.     precoProduto  FLOAT(4) NOT NULL,
  24.     categoria VARCHAR(7)
  25. );
  26. """)
  27.  
  28. login = Tk()
  29. login.geometry("350x350+200+150")
  30. login.title("Tela login")
  31.  
  32. def cadProdutoBind():
  33.     pass
  34.  
  35. def entrar():
  36.     if ed_login.get() == "matheus" and ed_senha.get() == "balieiro":
  37.         menu_principal = Tk()
  38.         menu_principal.geometry("1000x650")
  39.         login.destroy()
  40.  
  41.         def cad_produto():
  42.             cadastro_produto = Tk()
  43.             cadastro_produto.geometry("500x500+200+150")
  44.             menu_principal.destroy()
  45.            
  46.        
  47.            
  48.            
  49.          
  50.             frame_cadastro_top = Frame(cadastro_produto, height=100, bd=8, width=480,  relief='groove')
  51.             frame_cadastro_top.pack(side=TOP)
  52.  
  53.             titulo_cadastro_top = Label(frame_cadastro_top, font="arial 15  bold", width=40,  text="Cadastro do Produto", fg="black", relief="sunken", bg="gray")
  54.             titulo_cadastro_top.grid(row=0, column=2)
  55.  
  56.             frame_cadastro_meio = Frame(cadastro_produto, height=330,bd=8, width=500, relief="groove", bg="gray")
  57.             frame_cadastro_meio.place(x=0, y=50)
  58.  
  59.             bt_voltar = Button(frame_cadastro_meio, font="arial 15  bold",  text="Nome do Produto", fg="black")
  60.             bt_voltar.place(x=490, y=20)
  61.  
  62.             nome_cadastro_top = Label(frame_cadastro_meio, font="arial 15  bold",  text="Nome do Produto", fg="black", relief="raised", bg="gray")
  63.             nome_cadastro_top.place(x=20, y=20)
  64.  
  65.             nome_entry = Entry(frame_cadastro_meio, width=25)
  66.             nome_entry.place(x=20, y=55)
  67.  
  68.            
  69.             codigo_cadastro_top = Label(frame_cadastro_meio, font="arial 15  bold",  text="Codigo do Produto", fg="black", relief="raised", bg="gray")
  70.             codigo_cadastro_top.place(x=20, y=85)
  71.  
  72.             codigo_entry = Entry(frame_cadastro_meio, width=25)
  73.             codigo_entry.place(x=20, y=120)
  74.  
  75.             nome_cadastro_top = Label(frame_cadastro_meio, font="arial 15  bold",  text="Categoria", fg="black", relief="raised", bg="gray")
  76.             nome_cadastro_top.place(x=20, y=145)
  77.  
  78.             bt_biscoito = Checkbutton(frame_cadastro_meio, font="arial 10 bold", text="Biscoitos, Bolos e Bolachas", fg="black",  bg="gray")
  79.             bt_biscoito.place(x=20, y=175)
  80.  
  81.             bt_frios = Checkbutton(frame_cadastro_meio, font="arial 10 bold", text="Frios e Embutidos", fg="black",  bg="gray")
  82.             bt_frios.place(x=20, y=195)
  83.  
  84.             bt_pao = Checkbutton(frame_cadastro_meio, font="arial 10 bold", text="Pães", fg="black",  bg="gray")
  85.             bt_pao.place(x=20, y=215)
  86.  
  87.             bt_ovos = Checkbutton(frame_cadastro_meio, font="arial 10 bold", text="Ovos, Queijos, Leite, Cia", fg="black",  bg="gray")
  88.             bt_ovos.place(x=20, y=235)
  89.        
  90.             bt_congelado = Checkbutton(frame_cadastro_meio, font="arial 10 bold", text="Congelado", fg="black",  bg="gray")
  91.             bt_congelado.place(x=20, y=255)
  92.  
  93.             bt_bar = Checkbutton(frame_cadastro_meio, font="arial 10 bold", text="Restaurante", fg="black",  bg="gray")
  94.             bt_bar.place(x=250, y=175)
  95.  
  96.             bt_congelado = Checkbutton(frame_cadastro_meio, font="arial 10 bold", text="Bebidas", fg="black",  bg="gray")
  97.             bt_congelado.place(x=250, y=195)
  98.  
  99.             bt_cadastrar = Button(frame_cadastro_meio, font="arial 10 bold", text="Cadastrar Produto", relief="groove", fg="black", command = cadProdutoBind)
  100.             bt_cadastrar.place(x=140, y=285)
  101.  
  102.             frame_baixo = Frame(cadastro_produto, height=115, width=500, bg="gray", relief="groove", bd=8)
  103.             frame_baixo.pack(side=BOTTOM)
  104.  
  105.             S = Scrollbar(frame_baixo)
  106.             T = Text(frame_baixo, height=4, width=50)
  107.             S.pack(side=RIGHT)
  108.             T.pack(side=LEFT)
  109.             S.config(command=T.yview)
  110.             T.config(yscrollcommand=S.set)
  111.            
  112.             cadastro_produto.mainloop()
  113.         def controle_estoque():
  114.             estoque = Tk()
  115.             estoque.geometry("500x500+200+150")
  116.             menu_principal.destroy()
  117.  
  118.            
  119.            
  120.             estoque.mainloop()
  121.  
  122.         def controle_fornecedor():
  123.             fornecedor = Tk()
  124.             fornecedor.geometry("500x500+200+150")
  125.             menu_principal.destroy()
  126.  
  127.  
  128.  
  129.             fornecedor.mainloop()
  130.  
  131.            
  132.  
  133.  
  134.  
  135.  
  136.              
  137.  
  138.         topo_frame = Frame(menu_principal, width=900, height=100, bg="gray")
  139.         topo_frame.pack(side=TOP)
  140.  
  141.         btn_vendas = Button(topo_frame, width=10, height=5, text="Cad Produto", font="Arial 10 bold", relief="sunken", bg="cyan", command=cad_produto)
  142.         btn_vendas.place(x=50, y=5)
  143.  
  144.         btn_vendas = Button(topo_frame, width=10, height=5, text="Estoque", font="Arial 10 bold", relief="sunken", bg="white", command=controle_estoque)
  145.         btn_vendas.place(x=400, y=5)
  146.  
  147.         btn_vendas = Button(topo_frame, width=10, height=5, text="Fornecedor", font="Arial 10 bold", relief="sunken", bg="magenta", command=controle_fornecedor)
  148.         btn_vendas.place(x=765, y=5)
  149.  
  150.         menu_principal.mainloop()
  151.     else:
  152.         if ed_login.get() != "matheus" or ed_senha.get() != "balieiro":
  153.             messagebox.showinfo ("Title", "Login ou Senha incorreto")
  154.  
  155.  
  156.  
  157.  
  158. lbl_login = Label(login, text="Login", font ="Arial 20 bold")
  159. lbl_login.place(x=70, y=100)
  160.  
  161. ed_login = Entry(login, width=25)
  162. ed_login.place(x=160, y=110)
  163.  
  164. lbl_senha = Label(login, text="Senha", font ="Arial 20 bold")
  165. lbl_senha.place(x=70, y=140)
  166.  
  167. ed_senha = Entry(login, width=25, show="*")
  168. ed_senha.place(x=160, y=150)
  169.  
  170. ed_login.bind("<KeyPress>", lambda e: ed_senha.focus() if e.char == '\r' else None)
  171. ed_senha.bind("<KeyPress>", lambda e: entrar() if e.char == '\r' else None)
  172.  
  173. bt_conectar = Button(login, width=15, text="Conectar-se", font = "Arial 15 bold", command = entrar)
  174. bt_conectar.place(x=100, y=200)
  175.  
  176.  
  177.  
  178. login.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment