-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
98 lines (78 loc) · 3.12 KB
/
main.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# -*- coding: utf-8 -*-
from tkinter import Tk, PhotoImage, Toplevel
from tkinter import Entry as tkEntry
from tkinter.ttk import Frame, Label, Button, Entry, Separator, Style
'''
Title: Modern Interface for Python with Tkinter
by ngoma for Tabnews, 29.11.2022, Huambo-Angola
'''
# funcoes
def login():
print(f'{et_senha.get()}')
et_email.delete(0, 'end')
et_senha.delete(0, 'end')
et_email.focus_force()
def nova_conta():
et_email.focus_force()
# primeira linha
root = Tk()
# frames
bord = Frame(root, style='Borda.TFrame')
bord.pack(fill='x', expand=True)
lay_top = Frame(bord)
lay_top.pack()
center = Frame(bord)
center.pack()
base = Frame(bord)
base.pack()
logo = PhotoImage(file=r'logo_d.png')
lb_logo = Label(lay_top, image=logo)
lb_logo.image = logo
lb_logo.pack()
Label(center, text='E-mail').pack(anchor='w', pady=(10,0))
et_email = tkEntry(center, font=('Montserrat', 12, 'bold'), fg='#666', relief='flat',
highlightbackground='white', highlightcolor='white')
et_email.focus_force()
et_email.pack(fill='x')
Separator(center, orient='horizontal').pack(fill='x')
Label(center, text='Senha').pack(anchor='w', pady=(10,0))
et_senha = tkEntry(center, show='*', font=('Montserrat', 12, 'bold'), fg='#666', relief='flat',
highlightbackground='white', highlightcolor='white')
et_senha.pack()
Separator(center, orient='horizontal').pack(fill='x', pady=(0,20))
Button(base, text='ENTRAR', command=login, cursor='hand1').pack(fill='x', pady=(0,10))
Label(base, text='Ainda não tens uma conta? ', style='Small.TLabel').pack(side='left')
Button(base, text='Crie agora.', command=nova_conta, cursor='hand1', style='Small.TButton').pack(side='left')
# fontes
Tfont = ('Montserrat ExtraBold', 22)
Pfont = ('Montserrat', 10)
Pfontb = ('Montserrat', 12, 'bold')
Sfont = ('Montserrat', 8)
# estilo
style = Style()
style.theme_use('default')
style.configure('TFrame', background='#fff')
style.configure('Borda.TFrame', width=300)
style.configure('TLabel', justify='right', font=Pfont, background='#fff', foreground='#808080')
style.configure('Small.TLabel', font=Sfont)
style.configure('TButton', padding=(60,7), font=Pfontb, foreground='#fff', background='#20bcbb', relief='')
style.configure('Small.TButton', padding=(0,-3), font=Sfont, width=0, height=0, foreground='#20bcbb', background='#fff', relief='')
style.configure('TSeparator', background='#bafafa')
style.map('TButton',
foreground=[('pressed', '#e25ca5'), ('active', '#fff')],
background=[('pressed', '!focus', '#3f8efc'), ('active', '#025b5a')],
relief=[('pressed', 'flat'), ('!pressed', 'flat')])
style.map('Small.TButton',
foreground=[('pressed', '#f3bb30'), ('active', '#025b5a')],
background=[('pressed', '!focus', '#3f8efc'), ('active', '#fff')],
relief=[('pressed', 'flat'), ('!pressed', 'flat')])
# print(Toplevel().keys())
# print(root.winfo_toplevel())
# ultimas linhas
root.title('Design moderno - tkinter')
# root.wm_manage()('Ngoma Tk')
root.geometry('400x550+100+100')
root.iconphoto(False, PhotoImage(file='logo_da.png'))
# root.wm_attributes('-fullscreen', 'True')
root.configure(bg='#fff')
root.mainloop()