def __init__(self, win, selected_row): self.win = win self.selected_row = selected_row window_height = 250 window_width = 515 self.bg = 'LightBlue1' self.win.geometry(f'{window_width}x{window_height}') self.win.resizable(width=False, height=False) self.win.wm_title("Accounts Savier") self.win.configure(bg=self.bg) label_login = tk.Label(self.win, text='Comment: ') label_login.config(font=("Comic 12 italic")) label_login.place(x=20, y=10) self.comment_text = tk.Text(self.win, font=("Comic 16 italic"), width=39, height=6) self.comment_text.place(x=20, y=40) button_ok = tk.Button(self.win, text='OK', command=self.ok_command) button_ok.place(x=150, y=200, width=100) button_cancel = tk.Button(self.win, text='Cancel', command=self.win.destroy) button_cancel.place(x=270, y=200, width=100) self.comment_text.insert(tk.END, self.selected_row[4]) self.db = backend.Database()
from PySide2.QtWidgets import QWidget, QScrollArea, QLabel, QDateTimeEdit, QComboBox, QTextEdit, \ QPushButton, QVBoxLayout, QHBoxLayout, QFormLayout, QFrame, QMessageBox from PySide2.QtGui import QIcon, QPixmap, Qt from PySide2.QtCore import QDateTime import backend db = backend.Database("sr-data.db") defaultImg = "assets/icons/logo-dark.png" class AddIssue(QWidget): def __init__(self, parent): QWidget.__init__(self) self.setWindowTitle("Add issue") self.setWindowIcon(QIcon("assets/icons/icon.ico")) self.setGeometry(450, 150, 750, 950) # self.setFixedSize(self.size()) self.Parent = parent self.UI() self.show() def UI(self): self.widgets() self.layouts() def widgets(self): self.scroll = QScrollArea()
from flask import Flask, render_template, request import backend app = Flask(__name__) db = backend.Database() @app.route('/') def index(): return render_template("index.html") @app.route('/success', methods=['POST']) def success(): if request.method == 'POST': email = request.form["email_name"] height = request.form["height_value"] db.insert(email, height) backend.send_email(email, db.return_average_height()) return render_template("success.html") if __name__ == "__main__": app.run(debug=True)
self.add_button_to_frame( lambda: helper.get_container().show_frame( frame_name=frames.mainframes.TurnOffFrame.__name__), global_var.images["power"]) def add_button_to_frame(self, command, image): helper.get_button(self, command=command, background=global_var.DARK_COLOUR, image=image).pack(side='left', fill="x", expand=True) if __name__ == "__main__": fileManager.setup() global_var.database = backend.Database() global_var.app = Application() # Create app global_var.app.attributes('-fullscreen', True) # Attributes global_var.app.title(global_var.PROJECT_TITLE) height = global_var.app.winfo_screenwidth() global_var.app.tk.call("tk", "scaling", height / 900) helper.create_images() global_var.app.setup() # Create frames global_var.app.mainloop() # Start GUI
def __init__(self, window_update, selected_row): self.db = backend.Database() self.bg = 'LightBlue1' self.window_update = window_update self.window_update.geometry("330x500") self.window_update.resizable(width=False, height=False) self.window_update.wm_title("Account Updating") self.selected_row = selected_row # all label widgets label_login = tk.Label(self.window_update, text='Login: '******'Password: '******'Site: ') label_site.config(font=("Comic 12 italic"), bg=self.bg) label_site.place(x=20, y=180) label_comment = tk.Label(self.window_update, text='Comment: ') label_comment.config(font=("Comic 12 italic"), bg=self.bg) label_comment.place(x=20, y=265) # all entry widgets self.update_login_input_var = tk.StringVar() self.login_entry = tk.Entry(self.window_update, font=("Comic 12 italic"), textvariable=self.update_login_input_var) self.login_entry.insert(0, self.selected_row[1]) self.login_entry.place(x=20, y=50, width=290, height=30) self.update_password_input_var = tk.StringVar() self.password_entry = tk.Entry( self.window_update, font=("Comic 12 italic"), textvariable=self.update_password_input_var) self.password_entry.insert(0, self.selected_row[2]) self.password_entry.place(x=20, y=135, width=290, height=30) self.update_site_input_var = tk.StringVar() self.site_entry = tk.Entry(self.window_update, font=("Comic 12 italic"), textvariable=self.update_site_input_var) self.site_entry.insert(0, self.selected_row[3]) self.site_entry.place(x=20, y=220, width=290, height=30) self.update_comment_text = ScrolledText(self.window_update, font=("Comic 12 italic"), width=30, height=6) self.update_comment_text.insert("1.0", self.selected_row[4]) self.update_comment_text.place(x=20, y=305) # all button widgets button_submit_update = tk.Button(self.window_update, text='OK', command=self.submit_update) button_submit_update.config(width=10, height=1, font=("Comic 12 italic"), activebackground='SpringGreen2', bd=1) button_submit_update.place(x=40, y=450) button_cancel_update = tk.Button(self.window_update, text='Cancel', command=window_update.destroy) button_cancel_update.config(width=10, height=1, font=("Comic 12 italic"), activebackground='SpringGreen2', bd=1) button_cancel_update.place(x=180, y=450)
def __init__(self, window): """ Basicly frontend of the main window """ # initializing self.db = backend.Database() self.key = 'ghbdtnhf' window_height = 620 window_width = 840 self.bg = 'LightBlue1' self.window = window self.window.geometry(f'{window_width}x{window_height}') self.window.resizable(width=False, height=False) self.window.wm_title("Accounts Savier") self.window.configure(bg=self.bg) # all LABLES widgets on the main window label_login = tk.Label(self.window, text='Add New Login') label_login.config(font=("Comic 25 italic"), bg=self.bg) label_login.place(x=300, y=10) label_login = tk.Label(self.window, text='Login: '******'Password: '******'Site: ') label_password.config(font=("Comic 12 italic"), bg=self.bg) label_password.place(x=30, y=140) label_comment = tk.Label(self.window, text='Comment: ') label_comment.config(font=("Comic 12 italic"), bg=self.bg) label_comment.place(x=430, y=70) label_results = tk.Label(self.window, text='Accounts: ') label_results.config(font=("Courier", 10), bg=self.bg) label_results.place(x=30, y=250) # all INPUTS widgets on the main window self.login_input_var = tk.StringVar() self.login_entry = tk.Entry(self.window, font=("Comic 12 italic"), textvariable=self.login_input_var) self.login_entry.place(x=170, y=70, width=230, height=30) self.password_input_var = tk.StringVar() self.password_entry = tk.Entry(self.window, font=("Comic 12 italic"), show="*", textvariable=self.password_input_var) self.password_entry.place(x=170, y=105, width=230, height=30) self.site_input_var = tk.StringVar() self.site_entry = tk.Entry(self.window, font=("Comic 12 italic"), textvariable=self.site_input_var) self.site_entry.place(x=170, y=140, width=230, height=30) self.search_entry = EntryWithPlaceholder(self.window, 'write here to find') self.search_entry.place(x=30, y=500, width=387, height=30) self.comment_text = ScrolledText(self.window, width=30, height=6) self.comment_text.place(x=540, y=70) # all BUTTONS widgets on the main window button_clear = tk.Button(self.window, text='Clear', command=self.clear) button_clear.config(width="10", height="1", font=("Comic 12 italic"), activebackground='SpringGreen2', bd=1) button_clear.place(x=700, y=175) button_submit = tk.Button(self.window, text='Submit', command=self.submit) button_submit.config(width="15", height="2", font=("Comic 15 italic"), activebackground='SpringGreen2', bd=1) button_submit.place(x=360, y=180) button_delete = tk.Button(self.window, text='Delete', command=self.delete_account) button_delete.config(width=15, height=2, font=("Comic 12 italic"), activebackground='SpringGreen2', bd=1) button_delete.place(x=650, y=390) button_update = tk.Button(self.window, text='Update', command=self.update_account) button_update.config(width=15, height=2, font=("Comic 12 italic"), activebackground='SpringGreen2', bd=1) button_update.place(x=650, y=330) button_refresh = tk.Button(self.window, text='Refresh', command=self.view_accounts) button_refresh.config(width=15, height=2, font=("Comic 12 italic"), activebackground='SpringGreen2', bd=1) button_refresh.place(x=650, y=270) button_close = tk.Button(self.window, text='Close', command=self.window.destroy) button_close.config(width=15, height=2, font=("Comic 12 italic"), activebackground='SpringGreen2', bd=1) button_close.place(x=650, y=450) button_copy_login = tk.Button(self.window, text='Copy\nLogin', command=self.copy_login) button_copy_login.config(width=12, height=2, font=("Comic 12 italic"), activebackground='SpringGreen2', bd=1) button_copy_login.place(x=30, y=440) button_copy_password = tk.Button(self.window, text='Copy\nPassword', command=self.copy_password) button_copy_password.config(width=12, height=2, font=("Comic 12 italic"), activebackground='SpringGreen2', bd=1) button_copy_password.place(x=160, y=440) button_copy_site = tk.Button(self.window, text='Copy\nSite', command=self.copy_site) button_copy_site.config(width=12, height=2, font=("Comic 12 italic"), activebackground='SpringGreen2', bd=1) button_copy_site.place(x=290, y=440) button_read_comment = tk.Button(self.window, text='Read\nComment', command=self.read_comment) button_read_comment.config(width=12, height=2, font=("Comic 12 italic"), activebackground='SpringGreen2', bd=1) button_read_comment.place(x=420, y=440) button_search = tk.Button(self.window, text='Search', command=self.search) button_search.config(width=12, height=1, font=("Comic 12 italic"), activebackground='SpringGreen2', bd=1) button_search.place(x=420, y=500) # more widgets on the main window self.listbox = tk.Listbox(self.window, font=("Comic 12 italic")) self.listbox.bind('<<ListboxSelect>>', self.get_selected_row) self.listbox.place(x=30, y=275, width=500, height=150) scrollbar = tk.Scrollbar(self.window) scrollbar.place(x=535, y=275, height=150) self.listbox.configure(yscrollcommand=scrollbar.set) scrollbar.configure(command=self.listbox.yview) self.view_accounts() self.var = tk.IntVar() self.var.set(0) all_radio = tk.Radiobutton(self.window, text='Search in all fields', variable=self.var, value=0, bg=self.bg) all_radio.place(x=30, y=550) login_radio = tk.Radiobutton(self.window, text="Login", variable=self.var, value=1, bg=self.bg) login_radio.place(x=175, y=550) password_radio = tk.Radiobutton(self.window, text="Password", variable=self.var, value=2, bg=self.bg) password_radio.place(x=175, y=580) site_radio = tk.Radiobutton(self.window, text="Site", variable=self.var, value=3, bg=self.bg) site_radio.place(x=300, y=550) comment_radio = tk.Radiobutton(self.window, text="Comment", variable=self.var, value=4, bg=self.bg) comment_radio.place(x=300, y=580)