Exemplo n.º 1
0
    def instructions(self):
        """Open instructions window."""
        # Instantiates separate Toplevel instruction window.
        instr_window = Toplevel(self.root)
        instr_window.geometry('550x575+25+25')
        instr_window.title('Instructions')
        instr_window.wm_iconbitmap(constants.ICO)
        instr_window.resizable(False, False)

        # Creatse Scrollbar and Frame for containing other widgets.
        instr_scroll = Scrollbar(instr_window)
        instr_scroll.pack(fill=Y, side="right")
        instr_frame = Frame(instr_window, bg='white')
        instr_frame.pack(fill=BOTH, side="left")

        # Adds instruction text from constants and adds image of Cinzano's diagram.
        instr = Text(instr_frame,
                     width=65,
                     height=40,
                     padx=10,
                     pady=5,
                     bd=0,
                     wrap="word")
        instr.insert("end", constants.INSTR)
        cdiagram_file = Image.open("./static/cinzano_diagram.PNG")
        cdiagram_file = cdiagram_file.resize((500, 450), Image.ANTIALIAS)
        self.cdiag = ImageTk.PhotoImage(cdiagram_file)
        instr.image_create("end", image=self.cdiag)
        instr.tag_add("top", "1.0", "4.10")
        instr.tag_config("top", font='Times 12 bold')
        instr.tag_add("body", "5.0", "19.20")
        instr.tag_config("body", font='Times 12')
        instr.insert("end", constants.CDIAG)
        instr.pack()
        instr_scroll.config(command=instr.yview)
Exemplo n.º 2
0
def excel_popup(field):
    sub_window = Toplevel(background="#333", padx=15, pady=15)
    sub_window.title("Aya's Finder: Import data from Excel file")
    sub_window.wm_iconbitmap(r"images\Dna-Helix.ico")
    row_col = StringVar()
    row_col.set("row")

    Radiobutton(sub_window, variable=row_col, value="row", text="Row").grid(row=0, column=0)
    Radiobutton(sub_window, variable=row_col, value="col", text="Column").grid(row=0, column=1)
    file_name_var = StringVar()
    sheet_name_var = StringVar()
    num_var = IntVar()

    Label(sub_window, justify="left", width="17", text="File name").grid(row=1, column=0)
    Label(sub_window, justify="left", width="17", text="Sheet name").grid(row=2, column=0)
    Label(sub_window, justify="left", width="17", text="Row/Column number").grid(row=3, column=0)
    Entry(sub_window, width="32", textvariable=file_name_var).grid(row=1, column=1)
    Entry(sub_window, width="7", textvariable=num_var).grid(row=3, column=1)
    sheets = OptionMenu(sub_window, sheet_name_var, '')
    sheets.config(width=32)
    sheets.grid(row=2, column=1)

    def get():
        file_name = file_name_var.get()
        sheet_name = sheet_name_var.get()
        num = num_var.get()
        try:
            if row_col.get() == "row":
                field.delete(1.0, END)
                field.insert(INSERT, get_from_excel(file_name, sheet_name, row_num=num))
            else:
                field.delete(1.0, END)
                field.insert(INSERT, get_from_excel(file_name, sheet_name, col_num=num))
            sub_window.destroy()
        except Exception:
            pass

    def browser():
        try:
            name = askopenfilename(parent=sub_window)
            file_name_var.set(name)
            sheets.set_menu('---', *get_excel_sheets(file_name_var.get()))
            sub_window.focus()
        except IOError:
            pass

    Button(sub_window, text="OK", command=get).grid(row=5, column=0)
    Button(sub_window, text="Cancel", command=lambda: sub_window.destroy()).grid(row=5, column=1)
    Button(sub_window, text="browse", command=browser).grid(row=1, column=3)
Exemplo n.º 3
0
    def about(self):
        """Open an about window.

        Window gives authors, SET version number, and icon credit.
        """
        # Instantiates a new Toplevel about window.
        about_window = Toplevel(self.root)
        about_window.geometry('350x335+25+25')
        about_window.title('About')
        about_window.wm_iconbitmap(constants.ICO)
        about_window.resizable(False, False)

        # Adds text to about window.
        about = Text(about_window, width=50, height=30, padx=10, pady=3)
        about.insert("end", constants.ABOUT)
        about.tag_add("abt", "1.0", "21.30")
        about.tag_config("abt", font='Times 10 bold', justify=CENTER)
        about.pack()