Advertisement
LinuxEducation

LoginPanel

Mar 26th, 2023
786
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.99 KB | Source Code | 0 0
  1. from CodeTestApp import App, AppLabel
  2. from tesFrame import tesFrame
  3. from tesEntry import tesEntry
  4. from tesButton import tesButton
  5. from tkinter import Label, PhotoImage
  6.  
  7. class LoginPanel:
  8.     def create_UI(self, app):
  9.         frame = {'width':       340,
  10.                  'height':      360,
  11.                  'radius':      30,
  12.                  'background':  '#39404a',
  13.                  'bordercolor': '#263238'}
  14.        
  15.         entry = {'width':       250,
  16.                  'height':      40,
  17.                  'radius':      11,
  18.                  'background':  '#D8D8D8'}
  19.  
  20.         button = {'width':          250,
  21.                  'height':          40,
  22.                  'radius':          11,
  23.                  'background':      'red',
  24.                  'bordercolor':     '#263238',
  25.                  'backgroundidx':   3,
  26.                  'bordercolor':     'red',
  27.                  'border':          1,
  28.                  'text':            'Sign In',
  29.                  'textcolor':       'white',
  30.                  'command':         self.logged}
  31.  
  32.         self.lg = tesFrame(app, **frame) ; self.lg.pack(expand=True)
  33.         self.icon = PhotoImage(file='./icons/user1.png') ; Label(self.lg.tkinterframe, image=self.icon, background='#39404a').pack(pady=(10,20))
  34.         self.log = tesEntry(self.lg.tkinterframe,  icon='./icons/user3.png', text='Login', **entry) ; self.log.pack(pady=(0,5))
  35.         self.pas = tesEntry(self.lg.tkinterframe, icon='./icons/key1.png', text='*****', **entry) ; self.pas.pack()
  36.         tesButton(self.lg.tkinterframe, **button).pack(pady=20)
  37.  
  38.     def logged(self, event=None):
  39.         if self.log.get() and self.pas.get():
  40.             self.lg.destroy()
  41.             self.__create_UI()
  42.             app.unbind('<Return>')
  43.  
  44.     def __create_UI(self):
  45.         message = AppLabel(app, text="This Window is a 'Container' for other code")
  46.  
  47.  
  48. app = App('Login Panel', '#313338')
  49. ui = LoginPanel()
  50. ui.create_UI(app)
  51. app.bind('<Return>', ui.logged)
  52. app.mainloop()
  53.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement