Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as tk
- from AgileBooks.controllers.login import submit_login
- global_font = 'Helvetica'
- global_bg = 'gray25'
- global_fg = 'lawn green'
- class MainFrame():
- # Frame:
- frm_login = tk.Tk()
- frm_login.title('Login | AgileBooks - Copyright Gonzalo Dambra')
- frm_login.geometry('400x300')
- frm_login.configure(background=global_bg)
- # Labels:
- lbl_username = tk.Label(frm_login, text='Username', bg=global_bg, fg=global_fg, font=(global_font, 16))
- lbl_username.place(x=150, y=50)
- lbl_password = tk.Label(frm_login, text='Password', bg=global_bg, fg=global_fg, font=(global_font, 16))
- lbl_password.place(x=150, y=125)
- # Inputtexts:
- txt_username = tk.Entry(frm_login, font=(global_font, 14))
- txt_username.focus()
- txt_username.place(x=100, y=80, height=25, width=200)
- txt_password = tk.Entry(frm_login, show='*',font=(global_font, 14))
- txt_password.place(x=100, y=155, height=25, width=200)
- # Button:
- btn_login = tk.Button(frm_login, text='Login', font=(global_font, 16), bg=global_bg, fg=global_fg,
- command=submit_login(txt_username.get(), txt_password.get()))
- btn_login.place(x=165, y=200, height=25)
- def main():
- frame = MainFrame()
- frame.frm_login.mainloop()
- if __name__ == '__main__':
- main()
- def submit_login(username, password):
- if len(username) > 0 and len(password) > 0:
- print('Username: ', username, ' | Password: ', password)
- else:
- print('One of the fields is not filled.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement