-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo_6-loging.py
53 lines (45 loc) · 2 KB
/
demo_6-loging.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from tkmodule import App, AppLabel
from widgets import tesFrame, tesButton, tesEntry
from tkinter import Label, PhotoImage
class LoginPanel:
def create_UI(self, app):
frame = {'width': 340,
'height': 360,
'radius': 30,
'background': '#39404a',
'bordercolor': '#263238'}
entry = {'width': 250,
'height': 40,
'radius': 11,
'background': '#D8D8D8',
'bordercolor': '#A4A4A4',
'iconposition': 'w'}
button = {'width': 250,
'height': 40,
'radius': 11,
'background': 'red',
'backgroundidx': 3,
'bordercolor': 'red',
'border': 1,
'text': 'Sign In',
'textcolor': 'white',
'command': self.logged,
'animation': 'border'}
self.lg = tesFrame(app, **frame) ; self.lg.pack(expand=True)
self.icon = PhotoImage(file='./icons/user1.png') ; Label(self.lg.tkinterframe, image=self.icon, background='#39404a').pack(pady=(10,20))
self.log = tesEntry(self.lg.tkinterframe, icon='./icons/user3.png', text='Login', **entry) ; self.log.pack(pady=(0,5))
self.pas = tesEntry(self.lg.tkinterframe, icon='./icons/key1.png', text='*****', **entry) ; self.pas.pack()
tesButton(self.lg.tkinterframe, **button).pack(pady=20)
def logged(self, event=None):
if self.log.get() and self.pas.get():
self.lg.destroy()
self.__create_UI()
app.unbind('<Return>')
@staticmethod
def __create_UI():
AppLabel(app, text="This Window is a 'Container' for other code")
app = App('Login Panel', '#313338')
ui = LoginPanel()
ui.create_UI(app)
app.bind('<Return>', ui.logged)
app.mainloop()