Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2018
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.98 KB | None | 0 0
  1. #coding:utf-8
  2. from tkinter import *
  3. from tkinter import messagebox as ms
  4. import time
  5. #Créations des fonctions et test de connexion
  6.  
  7. def login():
  8.     def revenir():
  9.         fen1.destroy()
  10.         root.deiconify()
  11.     username = "odoo"
  12.     password = "interface"
  13.    
  14.     #On teste les variables de controle pour se connecter
  15.     if usernameInput.get() == username and passwordInput.get() == password:
  16.         #On efface les champs de connexion
  17.         entre1.delete(0, END)
  18.         entre1.insert(0, "")
  19.         entre2.delete(0, END)
  20.         entre2.insert(0, "")
  21.         #---------------------------------
  22.        
  23.         fen1 = Toplevel(root)
  24.         fen1.title("INTERFACE ")
  25.         fen1.geometry("1600x800+0+0")
  26.  
  27.         #Création des widgets
  28.         Tops = Frame(fen1)
  29.         Tops.pack(side=TOP)
  30.  
  31.         label1 = Label(Tops, text="Nom du fichier Excel : ")
  32.         btn1 = Button(Tops, text="Choose File", command="")
  33.         btn2 = Button(Tops, text="Extraction de données", command="")
  34.         btn3 = Button(Tops, text="Mise à jour", command="")
  35.         btn4 = Button(Tops, text="Verifier la mise à jour", command="")
  36.         btn5 = Button(Tops, text='BACK', command=revenir)
  37.  
  38.         #Afficahge de tous les widgets et positionnements
  39.         label1.grid(row=0, sticky=E)
  40.         btn1.grid(row=0, column=1, padx=5, pady=20)
  41.         btn2.grid(row=4, column=1, padx=5, pady=20)
  42.         btn3.grid(row=5, column=1, padx=5, pady=20)
  43.         btn4.grid(row=6, column=1, padx=5, pady=20)
  44.         btn5.grid(row=7, column=1, padx=5, pady=20)
  45.  
  46.         root.withdraw()
  47.     else:
  48.         ms.showerror('Oops!', 'Username and/or Password Not Found.')
  49.  
  50. #Création de la fenêtre avant de se logger
  51. #Création des fonctions
  52. #Création et paramétrage de la fenêtre
  53. root = Tk()
  54. root.title("Interface de connexion ")
  55. root.geometry("1600x800+0+0")
  56. #===========variables de controle ======================
  57. usernameInput = StringVar()
  58. passwordInput = StringVar()
  59.  
  60. #=======================Time=========================
  61. localtime = time.asctime(time.localtime(time.time()))
  62. #=======================Info===========================
  63. #Créations des widgets
  64. Tops = Frame(root, width=800, height=1000, bg="grey", relief='solid')
  65. Tops.pack(side=TOP)
  66.  
  67. lblInfo = Label(Tops, font=('arial', 50, 'bold'), text="Interface de connexion", fg="Steel Blue", bd=10, anchor='w')
  68. lblInfo.grid(row=0, column=0)
  69.  
  70. lblInfo = Label(Tops, font=('arial', 20, 'bold'), text=localtime, fg="Steel Blue", bd=10, anchor='w')
  71. lblInfo.grid(row=1, column=0)
  72.  
  73. label1 = Label(Tops, font=('arial', 20, 'bold'), text="Username : ")
  74. label1.grid(row=2, sticky=W, padx=5, pady=30)
  75.  
  76. label1 = Label(Tops, font=('arial', 20, 'bold'), text="Password : ")
  77. label1.grid(row=3, sticky=W, padx=5, pady=30)
  78.  
  79. entre1 = Entry(Tops, textvariable=usernameInput, relief=SUNKEN, cursor="arrow")
  80. entre1.grid(row=2, sticky=E, padx=5, pady=30)
  81.  
  82. entre2 = Entry(Tops, textvariable=passwordInput, show='*', relief=SUNKEN, cursor="arrow")
  83. entre2.grid(row=3, sticky=E, padx=5, pady=30)
  84.  
  85. signupButton = Button(Tops, font=('arial', 20, 'bold'), text='Sign up', command=login)
  86. signupButton.grid(columnspan=2, sticky=S, pady=30) 
  87.  
  88. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement