def __init__(self, tk_master): tk_master.geometry("710x500") tk_master.title("{} - Reportes".format(APP_NAME)) center_tk_window.center_on_screen(tk_master) tk_master.resizable(0, 0) frameContainer__Filter = Frame(tk_master) frameContainer__Filter.grid(row=1, column=1, sticky="nw") lblFilter = Label(frameContainer__Filter, text="Opciones de filtrado:") lblFilter.grid(row=0, column=0, padx=(0, 500)) self.txtSearch = Entry(frameContainer__Filter) self.txtSearch.insert(0, "Escriba palabra clave.") self.txtSearch.grid(row=0, column=0, padx=(200, 0)) self.cbFilter = ttk.Combobox(frameContainer__Filter, state="readonly") self.cbFilter["values"] = [ "Indistinto", "Numero de PIN", "Usuario", "Fecha" ] self.cbFilter.grid(row=0, column=0, padx=(0, 150)) self.btnSearch = Button(frameContainer__Filter, text="Buscar", command=lambda: self.loadSearchData()) self.btnSearch.grid(row=0, column=0, padx=(450, 0)) self.btnReset = Button(frameContainer__Filter, text="Restaurar", command=lambda: self.defaultLoadData()) self.btnReset.grid(row=0, column=0, padx=(620, 0)) frameTree = Frame(frameContainer__Filter) frameTree.grid(row=1, column=0) self.treeReport = ttk.Treeview(frameTree, height=22) self.treeReport["columns"] = ("one", "two", "three", "four", "five") self.treeReport.heading("one", text="ID") self.treeReport.heading("two", text="Num Pin") self.treeReport.heading("three", text="Valor") self.treeReport.heading("four", text="Usuario") self.treeReport.heading("five", text="Fecha") self.treeReport.column("one", width=50) self.treeReport.column("two", width=80) self.treeReport.column("three", width=80) self.treeReport.column("four", width=144) self.treeReport.column("five", width=150) self.treeReport.grid(row=0, column=0) self.defaultLoadData()
def main(): db = DatabaseManager("passmanager.db") root = make_root_window() center_tk_window.center_on_screen(root) encryption = Encryption(db) fill_layout(root, db, encryption) if db.has_master_pwd(): MasterDialogCheck(root, db, encryption) else: MasterDialogInit(root, db, encryption) root.mainloop()
def new_window(): top = Toplevel(width=300, height=300) top.title("Proceso terminado") master.withdraw() center_tk_window.center_on_screen(top) top.resizable(False, False) top.lift() label = Label(top, image=img1) label.image = img1 label.grid(row=0, column=0, padx=20, pady=20) label_1 = Label(top, text="Procesado") label_1.grid(row=5, column=0) progress_bar = Progressbar(top, orient="horizontal", mode="determinate", maximum=100, value=100) progress_bar.grid(row=6, column=0) button = Button(top, text="Terminar", width=50, command=terminate) button.grid(row=8, column=0, columnspan=2, sticky=W, pady=10)
def __init__(self, tk_master): self.instanceForm = tk_master tk_master.geometry("300x80") tk_master.title("{} - Inicio de sesion".format(APP_NAME)) center_tk_window.center_on_screen(tk_master) tk_master.resizable(0,0) self.handleLogin = LoginController() self.__valPassword = StringVar() lblUsername = Label(tk_master, text="Nombre de usuario:") lblUsername.grid(row=0, column=0) self.txtUsername = Entry(tk_master) self.txtUsername.grid(row=0, column=1) lblPassword = Label(tk_master, text="ContraseƱa:") lblPassword.grid(row=1, column=0) self.txtPassword = Entry(tk_master, show="*", textvariable=self.__valPassword) self.txtPassword.grid(row=1, column=1) self.btnLogin = Button(tk_master, text="Entrar", command=lambda:self.actionLogin()) self.btnLogin.grid(row=2, column=0)
def warning_msg(win, msg): win.geometry("350x100+0+0") win.wm_title('Dati mancanti') win.iconbitmap('media/alert.ico') bg_color = '#42423e' win['bg'] = bg_color pic = Image.open('media/alert.png') pic = pic.resize((64,64), Image.ANTIALIAS) img = ImageTk.PhotoImage(pic) frm = Frame(win, bg=bg_color) frm.pack(padx=20, pady=20) panel = Label(frm, image = img, bg=bg_color) panel.pack(side=LEFT, fill = "both", expand = "yes") Label(frm, text=msg, fg='white', bg=bg_color, font=('ubuntu', 14), wraplength=200).pack(side=LEFT, padx=10) center_tk_window.center_on_screen(win) ctypes.windll.shcore.SetProcessDpiAwareness(1) win.after(5000, lambda: win.destroy()) win.mainloop()
def process_sap(): import csv import sys import time with open('LT10_Transfers.csv', mode='r') as csv_file: total_rows = 0 for row in open("LT10_Transfers.csv"): total_rows += 1 csv_reader = csv.DictReader(csv_file) line_count = 0 top = Toplevel(width=300, height=400, cursor="watch") top.title("Transferencia de Inventario") master.withdraw() center_tk_window.center_on_screen(top) top.resizable(False, False) top.lift() label = Label(top, image=img1) label.image = img1 label.grid(row=0, column=0, padx=20, pady=20) label_1 = Label(top, text="En Proceso") label_1.grid(row=4, column=0) progress_bar = Progressbar(top, orient="horizontal", mode="determinate", maximum=100, value=0) progress_bar.grid(row=7, column=0) progress_bar.start() progress_bar.step(10) textbox = Text(top, height=9, width=30) textbox.grid(row=10, column=0) def saplogin(): import win32com.client import pythoncom import subprocess import ctypes try: path = r"C:\Program Files (x86)\SAP\FrontEnd\SAPgui\saplogon.exe" subprocess.Popen(path) time.sleep(10) # Necesario par correr win32com.client en Threading pythoncom.CoInitialize() sapmin = ctypes.windll.user32.FindWindowW( None, "SAP Logon 760") ctypes.windll.user32.ShowWindow(sapmin, 6) sapmin = ctypes.windll.user32.FindWindowW( None, "SAP Logon 740") ctypes.windll.user32.ShowWindow(sapmin, 6) SapGuiAuto = win32com.client.GetObject('SAPGUI') if not type(SapGuiAuto) == win32com.client.CDispatch: return application = SapGuiAuto.GetScriptingEngine if not type(application) == win32com.client.CDispatch: SapGuiAuto = None return connection = application.OpenConnection( "P02 - Production", True) if not type(connection) == win32com.client.CDispatch: application = None SapGuiAuto = None return session = connection.Children(0) if not type(session) == win32com.client.CDispatch: connection = None application = None SapGuiAuto = None return session.findById( "wnd[0]/usr/txtRSYST-BNAME").text = "etiquetado2" session.findById( "wnd[0]/usr/pwdRSYST-BCODE").text = "etiquetado02" session.findById("wnd[0]").sendVKey(0) except: print(sys.exc_info()) finally: session = None connection = None application = None SapGuiAuto = None saplogin() for row in csv_reader: if line_count == 0: line_count += 1 storage_unit = row["Stor.Unit"] if len(storage_unit) < 10: storage_unit = "0" + storage_unit line_count += 1 current_line = line_count - 1 total_lines = total_rows - 1 label_2 = Label(top, text=f"{current_line} de {total_lines}") label_2.grid(row=5, column=0) progress_bar.destroy() def capture(message): # print(f"{line_count - 1} Numero de Storage_Unit Procesado: {storage_unit} Status: OK") from datetime import date today = str(date.today()) with open(r'Resultado.csv', 'a', newline='') as csvfile: fieldnames = ['Storage Unit', 'Date', 'Error'] writer = csv.DictWriter(csvfile, fieldnames=fieldnames) writer.writerow({ 'Storage Unit': storage_unit, 'Date': today, 'Error': message }) textbox.insert( END, "Serial: " + storage_unit + ' Status: ' + "OK\n") textbox.see(END) def err(error): # print(f"{line_count - 1} Numero de Storage_Unit Procesado: {storage_unit} Status: Error") from datetime import date today = str(date.today()) with open(r'Resultado.csv', 'a', newline='') as csvfile: fieldnames = ['Storage Unit', 'Date', 'Error'] writer = csv.DictWriter(csvfile, fieldnames=fieldnames) writer.writerow({ 'Storage Unit': storage_unit, 'Date': today, 'Error': error }) textbox.insert( END, "Serial: " + storage_unit + ' Status: ' + "Err\n") textbox.see(END) # -Sub Main-------------------------------------------------------------- def Main(): import win32com.client import pywintypes import ctypes try: # Necesario par correr win32com.client en Threading #pythoncom.CoInitialize() sapmin = ctypes.windll.user32.FindWindowW( None, "P02(1)/200 SAP Easy Access") ctypes.windll.user32.ShowWindow(sapmin, 6) SapGuiAuto = win32com.client.GetObject("SAPGUI") if not type(SapGuiAuto) == win32com.client.CDispatch: return application = SapGuiAuto.GetScriptingEngine if not type(application) == win32com.client.CDispatch: SapGuiAuto = None return connection = application.Children(0) if not type(connection) == win32com.client.CDispatch: application = None SapGuiAuto = None return if connection.DisabledByServer == True: application = None SapGuiAuto = None return session = connection.Children(0) if not type(session) == win32com.client.CDispatch: connection = None application = None SapGuiAuto = None return if session.Info.IsLowSpeedConnection == True: connection = None application = None SapGuiAuto = None return session.findById("wnd[0]/tbar[0]/okcd").text = "LT09" session.findById("wnd[0]").sendVKey(0) session.findById( "wnd[0]/usr/txtLEIN-LENUM").text = storage_unit session.findById("wnd[0]/usr/ctxtLTAK-BWLVS").text = "998" session.findById("wnd[0]/usr/ctxtLTAK-BWLVS").setFocus() session.findById( "wnd[0]/usr/ctxtLTAK-BWLVS").caretPosition = 3 session.findById("wnd[0]").sendVKey(0) session.findById("wnd[0]/usr/ctxt*LTAP-NLTYP").text = "VUL" session.findById("wnd[0]/usr/ctxt*LTAP-NLBER").text = "001" session.findById( "wnd[0]/usr/txt*LTAP-NLPLA").text = variable.get() session.findById("wnd[0]/usr/txt*LTAP-NLPLA").setFocus() session.findById( "wnd[0]/usr/txt*LTAP-NLPLA").caretPosition = 6 session.findById("wnd[0]/tbar[0]/btn[11]").press() SAPmessage = session.findById("wnd[0]/sbar/pane[0]").Text time.sleep(.005) capture(SAPmessage) session.findById("wnd[0]/tbar[0]/btn[15]").press() except: # print(sys.exc_info()[0]) time.sleep(.005) SAPerror = session.findById("wnd[0]/sbar/pane[0]").Text session.findById("wnd[0]/tbar[0]/btn[15]").press() err(SAPerror) finally: session = None connection = None application = None SapGuiAuto = None time.sleep(.005) # -Main------------------------------------------------------------------ Main() # -End------------------------------------------------------------------- time.sleep(2) top.destroy() new_window()
chkb1.grid(row=12, column=3, columnspan=5, sticky=W, pady=0) chkb2.grid(row=13, column=3, columnspan=5, sticky=W, pady=0) chkb3.grid(row=14, column=3, columnspan=5, sticky=W, pady=0) OptionList = ["", "V01", "V02", "V03", "V04", "V05"] variable = StringVar(master) variable.set(OptionList[0]) opt = OptionMenu(lfw, variable, *OptionList, command=check_opt) opt.config(state=DISABLED) opt.grid(row=16, column=3, columnspan=1, sticky=W, pady=0) lw1 = Label(lfw, text="4.-Seleccionar ubicacion") lw1.grid(row=16, column=3, sticky=W, padx=55) # button widget b1 = Button(master, text="Transferir", width=50, state=DISABLED, command=lambda: startsap()) # arranging button widgets b1.grid(row=18, column=3, columnspan=5, sticky=W, pady=10) # infinite loop which can be terminated # by keyboard or mouse interrupt center_tk_window.center_on_screen(master) master.resizable(False, False) mainloop()
def __init__(self, parent): self._img_icon = "./img/image.ico" self._model = os.popen("wmic csproduct get name").read().replace("\n", "").replace(" ", "").replace("Name", "") self._service_tag = os.popen("wmic bios get serialnumber").read().replace("\n", "").replace(" ", "").replace( " ", "").replace("SerialNumber", "") self._my_system = platform.uname() self._background_color = "#152532" self._text_color = "#FCBD1E" self._logo_image = PhotoImage(file=r"./img/logo.png").subsample(10, 10) self.parent = parent self.parent.title("Monitor") self.parent.geometry("500x600") self.parent.configure(bg=self._background_color) self.parent.iconbitmap(self._img_icon) self._line_style = ttk.Style() self._line = ttk.Separator( self.parent, orient=VERTICAL, style="Line.TSeparator") self._labelGI = Label(self.parent, text="General Info", bg=self._background_color) self._labelName = Label(self.parent, text="Computer Name:\t {}".format(self._my_system.node), bg=self._background_color) self._labelUser = Label(self.parent, text="User Name:\t {}".format(os.environ['USERNAME']),bg=self._background_color) self._labelModel = Label(self.parent, text="Machine Model:\t {}".format(self._model), bg=self._background_color) self._labelSerial = Label(self.parent, text="Service Tag:\t {}".format(self._service_tag), bg=self._background_color, cursor="hand2") self._labelSerial = Label(self.parent, text="Service Tag:\t {}".format(self._service_tag), bg=self._background_color, cursor="hand2") self._labelSerial.bind("<Button-1>", lambda e: self.dell_support(self._service_tag)) self._labelOs = Label(self.parent, text="System Info:\t {} {} {} {}".format(self._my_system.system, self._my_system.release, self._my_system.machine, self._my_system.version), bg=self._background_color) self._label = Label(self.parent, image=self._logo_image, bg="#152532") self._frame = LabelFrame(self.parent, text="", width=300) self._labelGI.configure(fg=self._text_color) self._line_style.configure("Line.TSeparator", background=self._text_color) self._labelName.configure(fg=self._text_color) self._labelUser.configure(fg=self._text_color) self._labelModel.configure(fg=self._text_color) self._labelSerial.configure(fg=self._text_color) self._labelOs.configure(fg=self._text_color) self._frame.configure(bg=self._background_color) self.parent.columnconfigure(0, weight=1) self.parent.rowconfigure(8, weight=1) self._frame.columnconfigure(0, weight=1) self._frame.rowconfigure(7, weight=1) self._label.grid(row=0, column=0, columnspan=2, padx=90, pady=10) self._labelGI.grid(row=1, column=0, columnspan=1, padx=5, pady=.5, sticky=W) self._line.grid(row=2, columnspan=2, sticky=E + W) self._labelName.grid(row=3, column=0, padx=5, pady=.5, sticky=W) self._labelUser.grid(row=4, column=0, padx=5, pady=.5, sticky=W) self._labelModel.grid(row=5, column=0, padx=5, pady=.5, sticky=W) self._labelSerial.grid(row=6, column=0, padx=5, pady=.5, sticky=W) self._labelOs.grid(row=7, column=0, padx=5, pady=.5, sticky=W) self._frame.grid(row=8, column=0, columnspan=2, padx=5, pady=10, sticky=E + W + N + S) self.parent.wm_attributes("-alpha", .9) self.parent.resizable(False, True) # self.parent.protocol("WM_DELETE_WINDOW", self.withdraw_window) center_tk_window.center_on_screen(self.parent)
import tkinter as tk from tkinter.constants import RIGHT from PIL import ImageTk, Image import center_tk_window from tkinter import Toplevel import sqlite3 import tkinter.ttk as ttk #CREATE MAIN WINDOW root = tk.Tk() root.title("Address Book") root.configure(background="#F2F4F3") root.geometry("400x400") center_tk_window.center_on_screen(root) #Place address book icon in the corner root.iconbitmap('images\\icon.ico') #CREATE IMAGES: (people logo), resize image, show image image = Image.open("images\\people.png") image = image.resize((170, 170), Image.ANTIALIAS) people_image = ImageTk.PhotoImage(image) people_image_label = tk.Label(image=people_image, bg="#F2F4F3") people_image_label.place(x=200, y=150, anchor=tk.CENTER) #CREATE LABELS: start greeting, show label greeting_label = tk.Label(root, text="Welcome to your Address book!\n Click start", fg="#0A0908", bg="#F2F4F3") greeting_label.place(x=200, y=270, anchor=tk.CENTER)
import tkinter as tk import center_tk_window import minecraft_launcher_lib as ml from tkinter import messagebox import subprocess as sub import threading from pypresence import Presence import time login = tk.Tk() debug = True login.minsize(height=500, width=350) login.maxsize(height=500, width=350) login.title("Qubik Client - LogIn") login.iconphoto(False, tk.PhotoImage(file="images/login/logo.png")) center_tk_window.center_on_screen(login) tk.Canvas(login, bg="blue") lbackimg = tk.PhotoImage(file="images/login/login_window.png") lbackground_label = tk.Label(login, image=lbackimg) lbackground_label.place(x=0, y=0, relwidth=1, relheight=1) if debug is False: version = "ui.0.0.1.7.151120 | be.0.0.1.1.121120" else: version = "ui.0.0.1.7.151120 | be.0.0.1.1.121120 | Debug Mode" version_label = tk.Label(login, text=version) version_label.config(bg="#404040") version_label.place(x=0, y=480) # mojang status
def __init__(self, master, main_color, path_excel): self.master = master self.main_color = main_color self.path_excel = path_excel # *************************************************** # SEZIONE SUPERIORE (INSERIMENTO DATI) # *************************************************** self.root0 = Frame(self.master, bg=self.main_color) self.root0.pack(pady=20) # ID OPERATORE self.frm0 = Frame(self.root0, bg=self.main_color) self.frm0.pack(padx=10, pady=10, fill=BOTH) mytk.create_label(self.frm0, 'ID operatore', 12) self.opID = StringVar() self.opID_ent = mytk.create_entry(self.frm0, self.opID, 7) self.opID_ent.pack() self.opID_ent.focus() #--------------------------------------------- self.root1 = Frame(self.master, bg=self.main_color) self.root1.pack() #----- LATO SX -------------------------------------- self.container1 = Frame(self.root1, bg=self.main_color) self.container1.pack(side=LEFT, anchor=NW, padx=30, pady=15) # ORDINE DI PRODUZIONE self.frm1 = Frame(self.container1, bg=self.main_color) self.frm1.pack(padx=10, pady=20, fill=BOTH) mytk.create_label(self.frm1, 'Ordine di produzione') self.ordine = StringVar() self.ordine_ent = mytk.create_entry(self.frm1, self.ordine, 9) self.ordine_ent.bind('<FocusOut>', mytk.to_uppercase) self.ordine_ent.pack(side=LEFT) # CODICE ARTICOLO self.frm2 = Frame(self.container1, bg=self.main_color) self.frm2.pack(padx=10, pady=20, fill=BOTH) mytk.create_label(self.frm2, 'Codice articolo') self.codice = StringVar() self.codice_ent = mytk.create_entry(self.frm2, self.codice, 20) self.codice_ent.bind('<KeyRelease>', self.update_listbox) self.codice_ent.pack(side=LEFT) # LISTA CODICI ARTICOLO self.frm3 = Frame(self.container1, bg=self.main_color) self.frm3.pack(padx=10, pady=20, fill=BOTH) self.frm31 = Frame(self.frm3) self.frm31.pack(side=LEFT) mytk.create_label(self.frm31) self.frm32 = Frame(self.frm3, bg='white') self.frm32.pack(side=LEFT, fill=BOTH) self.lb = Listbox(self.frm32, bd=0, highlightthickness=0, highlightbackground='white', takefocus=0, selectmode=SINGLE) self.scrollb = Scrollbar(self.frm32, width=20, command=self.lb.yview) self.lb.config(yscrollcommand=self.scrollb.set) self.lb.bind('<Double-Button-1>', self.enter_item_code) self.scrollb.pack(side=RIGHT, fill=Y) self.lb.pack(padx=15, pady=15, fill=BOTH, expand=True) # add products code into the listbox self.item_list = eh.get_item_codes(self.path_excel) self.fill_listbox(self.item_list) # ------------------------------------------------------- #----- LATO DX --------------------------------------- self.container2 = Frame(self.root1, bg=self.main_color) self.container2.pack(side=LEFT, anchor=NW, padx=30, pady=15, fill=X) # OGGETTO DELLA RILEVAZIONE self.frm5 = Frame(self.container2, bg=self.main_color) self.frm5.pack(padx=10, pady=20, anchor=NW, fill=BOTH) mytk.create_label(self.frm5, 'Oggetto della rilevazione') self.ogg_rilev = ttk.Combobox( self.frm5, width=15, values=['prodotto finito', 'semilavorato', 'altro']) self.ogg_rilev.pack(side=LEFT, padx=50) mytk.create_label(self.frm5, '', width=10) # NUMERO SERIALE self.frm6 = Frame(self.container2, bg=self.main_color) self.frm6.pack(padx=10, pady=20, fill=BOTH) mytk.create_label(self.frm6, 'Numero seriale', 15) self.seriale = StringVar() self.seriale_ent = mytk.create_entry(self.frm6, self.seriale) self.seriale_ent.bind('<FocusOut>', mytk.to_uppercase) self.seriale_ent.pack(side=LEFT) self.checkVar = IntVar() mytk.create_label(self.frm6, '', 5) Checkbutton(self.frm6, var=self.checkVar, bg=self.main_color, activebackground=self.main_color, takefocus=0, relief=FLAT).pack(side=LEFT, padx=5) self.chkbtn_lbl = Label(self.frm6, text='Seriale non disponibile', anchor='w', fg='white', bg=self.main_color, font=('ubuntu', 12)) self.chkbtn_lbl.pack(side=LEFT) # DESCRIZIONE DEL PROBLEMA self.frm7 = Frame(self.container2, bg=self.main_color) self.frm7.pack(padx=10, pady=4, fill=BOTH) mytk.create_label(self.frm7, 'Descrizione') self.frm8 = Frame(self.container2, bg='white') self.frm8.pack(padx=10, pady=10, fill=BOTH) self.descr = Text(self.frm8, height=9, width=63, bd=0) self.descr.pack(side=LEFT, padx=15, pady=15) # ------------------------------------------------------- # *************************************************** # SEZIONE INFERIORE (TASTI) # *************************************************** self.root2 = Frame(self.master, bg=self.main_color) self.root2.pack(padx=250, fill=X) self.canc_btn = mytk.create_img_button( self.root2, 'media/button_cancella-tutto.png', 'media/button_cancella-tutto_hov.png', self.clear_all) self.canc_btn.pack(side=RIGHT, padx=10) self.agg_segn_btn = mytk.create_img_button( self.root2, 'media/button_aggiungi-segnalazione.png', 'media/button_aggiungi-segnalazione_hov.png', self.add_report) self.agg_segn_btn.pack(side=RIGHT) # *************************************************** # SEZIONE INFERIORE (EXCEL RECORDS) # *************************************************** self.root3 = Frame(self.master, bg=self.main_color) self.root3.pack(padx=250, pady=30, fill=X) self.root4 = Frame(self.master, bg=self.main_color) self.root4.pack() self.df = pd.read_excel(self.path_excel) self.records_frm = Frame(self.root4, bg=self.main_color) self.records_frm.pack(padx=20) self.tree_font = font.Font(family='ubuntu', size=12) self.last_records = ttk.Treeview(self.records_frm, height=7) ttk.Style().configure('Treeview', rowheight=30, font=('ubuntu', 12)) ttk.Style().configure('Treeview.Heading', font=('ubuntu', 12, 'bold')) self.column_list = list(self.df.columns) self.last_records['column'] = self.column_list # format columns for i, col in enumerate(self.column_list): if i == 1 or i == 3: width = self.tree_font.measure(col) + 70 elif i == 4: width = 400 else: width = self.tree_font.measure(col) + 30 self.last_records.column(col, width=width, minwidth=width, anchor=CENTER) # specify the labels to be displayed (thanks to the next # definition of the headings, the #0 column won't be showned) self.last_records['show'] = 'headings' # define the headings for column in self.last_records['column']: self.last_records.heading(column, text=column, anchor=CENTER) self.show_last_records() self.last_records.pack() center_tk_window.center_on_screen(self.master) self.update_treeview()
import tkinter as tk import center_tk_window from tkinter import messagebox settings = tk.Tk() settings.title("Settings") settings.overrideredirect(1) settings.iconphoto(False, tk.PhotoImage(file='images/resources/logo.png')) settings.minsize(width=272, height=350) settings.maxsize(width=272, height=350) center_tk_window.center_on_screen(settings) # images bgn = tk.Canvas(settings, bg="blue", height=250, width=300) backimg = tk.PhotoImage(file="images/settings/settingswindow.png") background_label = tk.Label(settings, image=backimg) background_label.place(x=0, y=0, relwidth=1, relheight=1) def safe(): print("All Safed!") tk.messagebox.showinfo("All settings Saved!", "All settings that you are made are now Saved!") settings.destroy() def dont_safe(): msgbox = tk.messagebox.askquestion('Close Without Saving?', 'Are you sure you want to close the Settings?') if msgbox == 'yes': settings.destroy() else: print("Abort Closing!")
def __init__(self, tk): self.instanceForm = tk tk.geometry("750x500") tk.config() tk.title(APP_NAME) center_tk_window.center_on_screen(tk) tk.resizable(0, 0) self.imageOn = PhotoImage(file="core/img/on.png") self.imageOff = PhotoImage(file="core/img/off.png") frameContainer__Title = Frame(tk) frameContainer__Title.pack() lblTitle = Label(frameContainer__Title, text=APP_NAME, font="Arial 22 bold") lblTitle.pack(pady=50) frameContainer__State = Frame(tk) frameContainer__State.pack(fill=NONE, expand=False) self.statePin13 = Label(frameContainer__State, image=self.imageOn, text="image size 30x30") self.statePin12 = Label(frameContainer__State, image=self.imageOn, text="image size 30x30") self.statePin11 = Label(frameContainer__State, image=self.imageOn, text="image size 30x30") self.statePin8 = Label(frameContainer__State, image=self.imageOn, text="image size 30x30") self.statePin7 = Label(frameContainer__State, image=self.imageOn, text="image size 30x30") self.statePin13.grid(row=0, column=0) self.statePin12.grid(row=0, column=1) self.statePin11.grid(row=0, column=2) self.statePin8.grid(row=0, column=3) self.statePin7.grid(row=0, column=4) frame_container__input = Frame(tk) frame_container__input.pack(fill=NONE, expand=False, pady=2, ipady=3) lblHI = Label(frame_container__input, text="Hora inicial (HI):") lblMI = Label(frame_container__input, text="Minuto inicial (MI):") lblHF = Label(frame_container__input, text="Hora final (HF):") lblMF = Label(frame_container__input, text="Minuto final (MF):") lblMode = Label(frame_container__input, text="Modo:") lblHI.grid(row=0, column=0) lblMI.grid(row=1, column=0) lblHF.grid(row=2, column=0) lblMF.grid(row=3, column=0) lblMode.grid(row=4, column=0, pady=(5, 0)) self.cbMode = ttk.Combobox(frame_container__input, state="readonly") self.cbMode["values"] = ["Normal", "Inverso"] self.cbMode.grid(row=4, column=1) self.txtHI = Entry(frame_container__input) self.txtMI = Entry(frame_container__input) self.txtHF = Entry(frame_container__input) self.txtMF = Entry(frame_container__input) self.txtHI.grid(row=0, column=1) self.txtMI.grid(row=1, column=1) self.txtHF.grid(row=2, column=1) self.txtMF.grid(row=3, column=1) self.btnSave = Button(frame_container__input, text="Guardar", command=lambda: self.saveCron()) self.btnSave.grid(row=5, column=0) self.btnClear = Button(frame_container__input, text="Limpiar", command=lambda: self.clearInputText()) self.btnClear.grid(row=5, column=1) self.btnReport = Button(frame_container__input, text="Reportes", command=lambda: self.openReport()) self.btnReport.grid(row=5, column=2) self.btnReport = Button(frame_container__input, text="Apagar", command=lambda: self.OffLed()) self.btnReport.grid(row=5, column=3) self.handlePin = Pin() self.handlePin.send(13, 8, False) self.handlePin.send(12, 6, False) self.handlePin.send(11, 4, False) self.handlePin.send(8, 2, False) self.handlePin.send(7, 0, False) self.updateForm()
print("Successfully created the directory %s " % path_game) path_status = "C:/Qubik Client Data/server_status.json" def status(): server_status = tk.StringVar() server_status.set(ma.get_status()) with open(path_status, "w") as f: f.write(server_status.get()) print(ma.get_status()) status() center_tk_window.center_on_screen(loading) tk.Canvas(loading, bg="blue") loadingscreen = tk.PhotoImage(file="images/loading/loadingwindow.png") loadingscreen_label = tk.Label(loading, image=loadingscreen) loadingscreen_label.place(x=0, y=0, relwidth=1, relheight=1) loadingbars = AnimatedGif(loading, "images/loading/loading_bars.gif", 0.025) loadingbars.config(borderwidth=0) loadingbars.place(x=260, y=282) loadingbars.start() def open_login(): try: sub.call(["login.py"])