예제 #1
0
    def __init__(self, title, control_queue, status):
        self.root = tk.Tk()
        self.root.title(title)
        self.root.geometry('1300x600')
        self.root.grid_rowconfigure(0, weight=1)
        self.root.grid_columnconfigure(0, weight=1)

        # Initialize variables
        self.queue = queue.Queue()
        self.control_queue = control_queue
        self.var_statusmsg = tk.StringVar(value="Initializing")
        self.status = status
        self.status_id = self.status.register_viewer(self.update_status,
                                                     self.queue)
        self.session = None
        self._session_opener = None

        self.cmd_map = {
            const.CMD_SET_SESSION: self.set_session,
            const.CMD_UPDATE_TRACES: self.update_traces,
        }

        self.display_stack = None
        self.channel_selection = {}
        self.channel_order = []
        self.frame_indicators = []
        #self.traces = None #replace by self.session.traces
        #self.trace_info = None # replace by self.session.trace_info
        #self.rois = None # replace by self.session.rois
        self.fig = None
        self.fig_widget = None
        self.save_dir = None
        self.last_frame_scroll = Event.now()

        self.var_show_frame_indicator = tk.BooleanVar(value=True)
        self.var_mode = tk.StringVar(value=MODE_HIGHLIGHT)
        self.var_darken_deselected = tk.BooleanVar(value=False)
        self.var_show_roi_contours = tk.BooleanVar(value=True)
        self.var_show_roi_names = tk.BooleanVar(value=True)
        self.var_show_untrackable = tk.BooleanVar(value=False)
        self.var_microscope_res = tk.StringVar(value=MIC_RES_UNSPEC)

        # Build menu
        menubar = tk.Menu(self.root)
        self.root.config(menu=menubar)

        filemenu = tk.Menu(menubar)
        menubar.add_cascade(label="File", menu=filemenu)
        filemenu.add_command(label="Open stack…", command=self.open_stack)
        filemenu.add_command(label="Open session", command=self.open_session)
        filemenu.add_command(label="Save", command=self.save)
        filemenu.add_command(label="Set output directory…",
                             command=self._get_savedir)
        filemenu.add_command(label="Quit", command=self.root.quit)

        modemenu = tk.Menu(menubar)
        menubar.add_cascade(label="Mode", menu=modemenu)
        modemenu.add_radiobutton(label="Highlight",
                                 value=MODE_HIGHLIGHT,
                                 variable=self.var_mode)
        modemenu.add_radiobutton(label="Selection",
                                 value=MODE_SELECTION,
                                 variable=self.var_mode)

        self.toolmenu = tk.Menu(menubar)
        menubar.add_cascade(label="Tools", menu=self.toolmenu)
        self.toolmenu.add_command(label=TOOL_LABEL_BINARIZE,
                                  command=self.binarize,
                                  state=tk.DISABLED)
        self.toolmenu.add_command(label="Pickle maximum bounding box",
                                  command=self._pickle_max_bbox)
        self.toolmenu.add_command(label="Background correction…",
                                  command=self._background_correction)
        settmenu = tk.Menu(menubar)
        menubar.add_cascade(label="Settings", menu=settmenu)
        settmenu.add_checkbutton(label="Display frame indicator",
                                 variable=self.var_show_frame_indicator)
        settmenu.add_checkbutton(label="Display cell contours",
                                 variable=self.var_show_roi_contours)
        settmenu.add_checkbutton(label="Display cell labels",
                                 variable=self.var_show_roi_names)
        settmenu.add_checkbutton(label="Display untracked cells",
                                 variable=self.var_show_untrackable)
        settmenu.add_checkbutton(label="Darken deselected cells",
                                 variable=self.var_darken_deselected)

        self.micresmenu = tk.Menu(settmenu)
        settmenu.add_cascade(label="Microscope resolution",
                             menu=self.micresmenu)
        for mic_opt in MIC_RES.keys():
            self._add_to_microscope_menu(mic_opt)
        MIC_RES[MIC_RES_UNSPEC] = None
        MIC_RES[MIC_RES_CUSTOM] = None
        self.micresmenu.insert(MIC_RES_UNSPEC_IDX,
                               'radiobutton',
                               label=MIC_RES_UNSPEC,
                               value=MIC_RES_UNSPEC,
                               variable=self.var_microscope_res,
                               command=lambda mo=MIC_RES_UNSPEC: self.
                               _change_microscope_resolution(mo))
        self.micresmenu.insert(MIC_RES_CUSTOM_IDX,
                               'radiobutton',
                               label=MIC_RES_CUSTOM,
                               value=MIC_RES_CUSTOM,
                               variable=self.var_microscope_res,
                               command=lambda mo=MIC_RES_CUSTOM: self.
                               _change_microscope_resolution(mo))

        helpmenu = tk.Menu(menubar)
        menubar.add_cascade(label="Help", menu=helpmenu)
        helpmenu.add_command(label="Breakpoint", command=self._breakpoint)
        helpmenu.add_command(label="Sleep 10s", command=self.sleep10)

        # Window structure
        self.paned = tk.PanedWindow(self.root,
                                    orient=tk.HORIZONTAL,
                                    sashwidth=2,
                                    sashrelief=tk.RAISED)
        self.paned.grid(row=0, column=0, sticky='NESW')

        ## Channels frame
        self.chanframe = tk.Frame(self.paned)
        self.paned.add(self.chanframe, sticky='NESW', width=150)
        self.chanframe.grid_columnconfigure(0, weight=1)

        self.open_btn = tk.Button(self.chanframe,
                                  text="Open stack...",
                                  command=self.open_stack)
        self.open_btn.grid(row=0, column=0, sticky='NEW', padx=10, pady=5)
        self.chansellbl = tk.Label(self.chanframe,
                                   text="Display channels",
                                   anchor=tk.W,
                                   state=tk.DISABLED)
        self.chansellbl.grid(row=1,
                             column=0,
                             sticky='NESW',
                             padx=10,
                             pady=(20, 5))
        self.chanselframe = tk.Frame(self.chanframe)
        self.chanselframe.grid(row=2, column=0, sticky='ESW')
        self.plotsellbl = tk.Label(self.chanframe,
                                   text="Plot traces",
                                   anchor=tk.W,
                                   state=tk.DISABLED)
        self.plotsellbl.grid(row=3,
                             column=0,
                             sticky='ESW',
                             padx=10,
                             pady=(20, 5))
        self.plotselframe = tk.Frame(self.chanframe)
        self.plotselframe.grid(row=4, column=0, sticky='ESW')

        ## Stack frame
        self.stackframe = tk.Frame(self.paned)
        self.paned.add(self.stackframe, sticky='NESW', width=650)
        self.stackviewer = StackViewer(parent=self.stackframe,
                                       root=self.root,
                                       show_buttons='contrast')

        ## Figure frame
        self.figframe = tk.Frame(self.paned)
        self.paned.add(self.figframe, sticky='NESW', width=500)
        self.create_figure()

        ## Statusbar
        self.statusbar = tk.Frame(self.root,
                                  padx=2,
                                  pady=2,
                                  bd=1,
                                  relief=tk.SUNKEN)
        self.statusbar.grid(row=1, column=0, sticky='NESW')
        tk.Label(self.statusbar, anchor=tk.W,
                 textvariable=self.var_statusmsg).pack(side=tk.LEFT,
                                                       anchor=tk.W)

        # Callbacks
        self.var_show_frame_indicator.trace_add('write',
                                                self._update_frame_indicator)
        self.var_darken_deselected.trace_add(
            'write', lambda *_: self.display_stack._listeners.notify('image'))
        self.var_show_roi_contours.trace_add('write',
                                             self._update_show_roi_contours)
        self.var_show_roi_names.trace_add('write', self._update_show_roi_names)
        self.var_show_untrackable.trace_add('write',
                                            self._update_show_untrackable)

        self.stackframe.bind('<Configure>', self._stacksize_changed)
        self.stackviewer.register_roi_click(self._roi_clicked)

        ## Set global key bindings for display and cell selection
        # Some key symbols for the keypad (KP_*) may not be available in all systems.
        bindings = (
            (KEYS_NEXT_CELL | KEYS_PREV_CELL | KEYS_HIGHLIGHT_CELL,
             self._key_highlight_cell),
            (KEYS_SHOW_CONTOURS, lambda _: self.var_show_roi_contours.set(
                not self.var_show_roi_contours.get())),
            (KEYS_NEXT_FRAME | KEYS_PREV_FRAME, self._key_scroll_frames),
            (KEYS_CHANNEL, self._key_change_channel),
            (KEYS_FIRST_FRAME | KEYS_LAST_FRAME, self._key_jump_frames),
        )
        for keysyms, callback in bindings:
            for keysym in keysyms:
                if len(keysym) > 1:
                    keysym = f"<{keysym}>"
                try:
                    self.root.bind(keysym, callback)
                except Exception:
                    if not (os.name == 'nt'
                            and re.fullmatch(r'<KP_\D.*>', keysym)):
                        # Cleaner start-up on Windows
                        # (the <KP_\D.*> keysyms are not available in Windows)
                        print(f"Failed to register keysym '{keysym}'")
예제 #2
0
botUsername = tk.StringVar()
botUsername.set("Loading...")

#  _____________________________________________________
# | Frame Creation | For defining the layout of the GUI |
#  ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
botInfoFrame = ttk.Frame(root, width=335, height=150, relief="raised")
addCommandsFrame = ttk.LabelFrame(root,
                                  height=200,
                                  width=400,
                                  text=" Add Command ")
settingsFrame = ttk.LabelFrame(botInfoFrame, text=" Settings ")
useCommandsFrame = ttk.LabelFrame(root, text=" Buttons ")
consoleNotebook = ttk.Notebook(root, style="primary.TNotebook")
settingsWindow = tk.PanedWindow(settingsFrame, orient=tk.VERTICAL)

#  _______________________________________________________
# | "Add Commands" | Contains buttons for adding commands |
#  ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
buttonNameEntry = ttk.Entry(
    addCommandsFrame)  # Entry field for adding a new command's name
buttonNameEntry.grid(column=1, row=0)
buttonNameTitle = ttk.Label(addCommandsFrame, text="Command Name")
buttonNameTitle.grid(column=0, row=0)

buttonCommandEntry = ttk.Entry(
    addCommandsFrame
)  # Entry field for adding a new command's text to be executed
buttonCommandEntry.grid(column=1, row=1)
buttonCommandTitle = ttk.Label(addCommandsFrame, text="Command Text")
예제 #3
0
def construct_app():
    """
    Construct the GUI application using Tkinter.

    """
    root = tk.Tk()
    root.title("PROJECT MANAGEMENT")

    root.geometry("+{}+{}".format(int(root.winfo_reqwidth()),
                                  int(root.winfo_reqheight())))

    main_panel = tk.PanedWindow()
    main_panel.pack(fill=tk.BOTH, expand=True)

    # ---------------------------------------------------LEFT PANEL-----------------------------------------------------

    left_panel = tk.PanedWindow(main_panel, bg="#004c72", orient=tk.VERTICAL)
    main_panel.add(left_panel)

    emp = tk.Label(left_panel,
                   text="EMPLOYEE",
                   font=font.Font(family='Copperplate Gothic Bold', size=15),
                   anchor=tk.W,
                   relief=tk.RAISED,
                   fg="white",
                   bg='#d11d53',
                   bd=5)
    left_panel.add(emp)

    name_window = tk.PanedWindow(left_panel,
                                 bg="#004c72",
                                 orient=tk.HORIZONTAL)
    left_panel.add(name_window)
    name_lbl = tk.Label(name_window,
                        text="Name:",
                        font=font.Font(family='Copperplate Gothic Bold',
                                       size=15),
                        bg="#004c72",
                        fg="white")
    name_val = tk.Entry(name_window)
    name_window.add(name_lbl)
    name_window.add(name_val)

    language_lbl = tk.Label(left_panel,
                            anchor=tk.W,
                            text="Language",
                            font=font.Font(family='Copperplate Gothic Bold',
                                           size=15,
                                           underline=True),
                            bg="#004c72",
                            fg="white")
    left_panel.add(language_lbl)

    language_window = tk.PanedWindow(left_panel,
                                     orient=tk.HORIZONTAL,
                                     bg="#004c72")
    left_panel.add(language_window)

    python_val = tk.IntVar()
    java_val = tk.IntVar()
    cpp_val = tk.IntVar()

    java_btn = tk.Checkbutton(language_window,
                              justify=tk.LEFT,
                              font=font.Font(family='Copperplate Gothic Bold',
                                             size=15),
                              text="Java",
                              onvalue=1,
                              offvalue=0,
                              variable=java_val,
                              bg="#a7e2ff")
    language_window.add(java_btn)

    python_btn = tk.Checkbutton(language_window,
                                justify=tk.LEFT,
                                text="Python",
                                font=font.Font(
                                    family='Copperplate Gothic Bold', size=15),
                                onvalue=1,
                                offvalue=0,
                                variable=python_val,
                                bg="#a7e2ff")
    language_window.add(python_btn)

    cpp_btn = tk.Checkbutton(language_window,
                             justify=tk.LEFT,
                             font=font.Font(family='Copperplate Gothic Bold',
                                            size=15),
                             text="C++",
                             onvalue=1,
                             offvalue=0,
                             variable=cpp_val,
                             bg="#a7e2ff")
    language_window.add(cpp_btn)

    domain_lbl = tk.Label(left_panel,
                          anchor=tk.W,
                          text="Domain",
                          font=font.Font(family='Copperplate Gothic Bold',
                                         size=15,
                                         underline=True),
                          bg="#004c72",
                          fg="white")
    left_panel.add(domain_lbl)

    domain_window = tk.PanedWindow(left_panel,
                                   orient=tk.HORIZONTAL,
                                   bg="#004c72")
    left_panel.add(domain_window)
    payments_val = tk.IntVar()
    tracking_val = tk.IntVar()
    inventory_val = tk.IntVar()
    payments_btn = tk.Checkbutton(domain_window,
                                  justify=tk.LEFT,
                                  text="Payments",
                                  font=font.Font(
                                      family='Copperplate Gothic Bold',
                                      size=15),
                                  onvalue=1,
                                  offvalue=0,
                                  variable=payments_val,
                                  bg="#a7e2ff")
    domain_window.add(payments_btn)
    tracking_btn = tk.Checkbutton(domain_window,
                                  justify=tk.LEFT,
                                  text="Tracking",
                                  font=font.Font(
                                      family='Copperplate Gothic Bold',
                                      size=15),
                                  onvalue=1,
                                  offvalue=0,
                                  variable=tracking_val,
                                  bg="#a7e2ff")
    domain_window.add(tracking_btn)
    inventory_btn = tk.Checkbutton(domain_window,
                                   justify=tk.LEFT,
                                   text="Inventory",
                                   font=font.Font(
                                       family='Copperplate Gothic Bold',
                                       size=15),
                                   onvalue=1,
                                   offvalue=0,
                                   variable=inventory_val,
                                   bg="#a7e2ff")
    domain_window.add(inventory_btn)

    type_lbl = tk.Label(left_panel,
                        text="Type",
                        anchor=tk.W,
                        font=font.Font(family='Copperplate Gothic Bold',
                                       size=15,
                                       underline=True),
                        bg="#004c72",
                        fg="white")
    left_panel.add(type_lbl)

    type_window = tk.PanedWindow(left_panel,
                                 orient=tk.HORIZONTAL,
                                 bg="#004c72")
    left_panel.add(type_window)
    frontend_val = tk.IntVar()
    backend_val = tk.IntVar()
    ios_val = tk.IntVar()
    android_val = tk.IntVar()
    frontend_btn = tk.Checkbutton(type_window,
                                  justify=tk.LEFT,
                                  text="Front-end",
                                  font=font.Font(
                                      family='Copperplate Gothic Bold',
                                      size=15),
                                  onvalue=1,
                                  offvalue=0,
                                  variable=frontend_val,
                                  bg="#a7e2ff")
    type_window.add(frontend_btn)
    backend_btn = tk.Checkbutton(
        type_window,
        justify=tk.LEFT,
        text="Back-end",
        font=font.Font(family='Copperplate Gothic Bold', size=15),
        onvalue=1,
        offvalue=0,
        variable=backend_val,
        bg="#a7e2ff")
    type_window.add(backend_btn)
    ios_btn = tk.Checkbutton(type_window,
                             justify=tk.LEFT,
                             text="Mobile Application: iOS",
                             font=font.Font(family='Copperplate Gothic Bold',
                                            size=15),
                             onvalue=1,
                             offvalue=0,
                             variable=ios_val,
                             bg="#a7e2ff")
    type_window.add(ios_btn)
    android_btn = tk.Checkbutton(
        type_window,
        justify=tk.LEFT,
        text="Mobile Application: Android",
        font=font.Font(family='Copperplate Gothic Bold'),
        onvalue=1,
        offvalue=0,
        variable=android_val,
        bg="#a7e2ff")
    type_window.add(android_btn)

    add_emp_btn = tk.Button(
        left_panel,
        text="Add Employee",
        font=font.Font(family='Copperplate Gothic Bold', size=15),
        command=lambda: dump_details(category="employee",
                                     data={
                                         "name": name_val.get(),
                                         "python": python_val.get(),
                                         "java": java_val.get(),
                                         "cpp": cpp_val.get(),
                                         "payments": payments_val.get(),
                                         "tracking": tracking_val.get(),
                                         "inventory": inventory_val.get(),
                                         "frontend": frontend_val.get(),
                                         "backend": backend_val.get(),
                                         "ios": ios_val.get(),
                                         "android": android_val.get()
                                     }))
    left_panel.add(add_emp_btn)

    project = tk.Label(left_panel,
                       text="PROJECT",
                       font=font.Font(family='Copperplate Gothic Bold',
                                      size=15),
                       anchor=tk.W,
                       relief=tk.RAISED,
                       fg="white",
                       bg='#d11d53',
                       bd=5)
    left_panel.add(project)

    p_name_window = tk.PanedWindow(left_panel,
                                   orient=tk.HORIZONTAL,
                                   bg="#004c72")
    left_panel.add(p_name_window)
    p_name_lbl = tk.Label(p_name_window,
                          text="Name:",
                          font=font.Font(family='Copperplate Gothic Bold',
                                         size=15),
                          bg="#004c72",
                          fg="white")
    p_name_val = tk.Entry(p_name_window)
    p_name_window.add(p_name_lbl)
    p_name_window.add(p_name_val)

    p_language_lbl = tk.Label(left_panel,
                              text="Language",
                              anchor=tk.W,
                              font=font.Font(family='Copperplate Gothic Bold',
                                             size=15,
                                             underline=True),
                              bg="#004c72",
                              fg="white")
    left_panel.add(p_language_lbl)

    p_language_window = tk.PanedWindow(left_panel,
                                       orient=tk.HORIZONTAL,
                                       bg="#004c72")
    left_panel.add(p_language_window)
    p_lang_val = tk.StringVar()
    p_java_btn = tk.Radiobutton(p_language_window,
                                justify=tk.LEFT,
                                text="Java",
                                font=font.Font(
                                    family='Copperplate Gothic Bold', size=15),
                                variable=p_lang_val,
                                value="java",
                                bg="#a7e2ff")
    p_language_window.add(p_java_btn)
    p_python_btn = tk.Radiobutton(p_language_window,
                                  justify=tk.LEFT,
                                  text="Python",
                                  font=font.Font(
                                      family='Copperplate Gothic Bold',
                                      size=15),
                                  variable=p_lang_val,
                                  value="python",
                                  bg="#a7e2ff")
    p_language_window.add(p_python_btn)
    p_cpp_btn = tk.Radiobutton(p_language_window,
                               justify=tk.LEFT,
                               text="C++",
                               font=font.Font(family='Copperplate Gothic Bold',
                                              size=15),
                               variable=p_lang_val,
                               value="cpp",
                               bg="#a7e2ff")
    p_language_window.add(p_cpp_btn)

    p_domain_lbl = tk.Label(left_panel,
                            anchor=tk.W,
                            text="Domain",
                            font=font.Font(family='Copperplate Gothic Bold',
                                           size=15,
                                           underline=True),
                            bg="#004c72",
                            fg="white")
    left_panel.add(p_domain_lbl)

    p_domain_window = tk.PanedWindow(left_panel,
                                     orient=tk.HORIZONTAL,
                                     bg="#004c72")
    left_panel.add(p_domain_window)
    p_domain_val = tk.StringVar()
    p_payments_btn = tk.Radiobutton(p_domain_window,
                                    justify=tk.LEFT,
                                    text="Payments",
                                    font=font.Font(
                                        family='Copperplate Gothic Bold',
                                        size=15),
                                    variable=p_domain_val,
                                    value="payments",
                                    bg="#a7e2ff")
    p_domain_window.add(p_payments_btn)
    p_tracking_btn = tk.Radiobutton(p_domain_window,
                                    justify=tk.LEFT,
                                    text="Tracking",
                                    font=font.Font(
                                        family='Copperplate Gothic Bold',
                                        size=15),
                                    variable=p_domain_val,
                                    value="tracking",
                                    bg="#a7e2ff")
    p_domain_window.add(p_tracking_btn)
    p_inventory_btn = tk.Radiobutton(p_domain_window,
                                     justify=tk.LEFT,
                                     text="Inventory",
                                     font=font.Font(
                                         family='Copperplate Gothic Bold',
                                         size=15),
                                     variable=p_domain_val,
                                     value="inventory",
                                     bg="#a7e2ff")
    p_domain_window.add(p_inventory_btn)

    p_type_lbl = tk.Label(left_panel,
                          anchor=tk.W,
                          text="Type",
                          font=font.Font(family='Copperplate Gothic Bold',
                                         size=15,
                                         underline=True),
                          bg="#004c72",
                          fg="white")
    left_panel.add(p_type_lbl)

    p_type_window = tk.PanedWindow(left_panel,
                                   orient=tk.HORIZONTAL,
                                   bg="#004c72")
    left_panel.add(p_type_window)
    p_type_val = tk.StringVar()
    p_frontend_btn = tk.Radiobutton(p_type_window,
                                    justify=tk.LEFT,
                                    text="Front-end",
                                    font=font.Font(
                                        family='Copperplate Gothic Bold',
                                        size=15),
                                    variable=p_type_val,
                                    value="frontend",
                                    bg="#a7e2ff")
    p_type_window.add(p_frontend_btn)
    p_backend_btn = tk.Radiobutton(p_type_window,
                                   justify=tk.LEFT,
                                   text="Back-end",
                                   font=font.Font(
                                       family='Copperplate Gothic Bold',
                                       size=15),
                                   variable=p_type_val,
                                   value="backend",
                                   bg="#a7e2ff")
    p_type_window.add(p_backend_btn)
    p_ios_btn = tk.Radiobutton(p_type_window,
                               justify=tk.LEFT,
                               text="Mobile Application: iOS",
                               font=font.Font(family='Copperplate Gothic Bold',
                                              size=15),
                               variable=p_type_val,
                               value="ios",
                               bg="#a7e2ff")
    p_type_window.add(p_ios_btn)
    p_android_btn = tk.Radiobutton(p_type_window,
                                   justify=tk.LEFT,
                                   text="Mobile Application: Android",
                                   font=font.Font(
                                       family='Copperplate Gothic Bold',
                                       size=15),
                                   variable=p_type_val,
                                   value="android",
                                   bg="#a7e2ff")
    p_type_window.add(p_android_btn)

    emp_count_window = tk.PanedWindow(left_panel,
                                      bg="#004c72",
                                      orient=tk.HORIZONTAL)
    left_panel.add(emp_count_window)
    emp_count_lbl = tk.Label(emp_count_window,
                             text="Employee Count:",
                             font=font.Font(family='Copperplate Gothic Bold',
                                            size=15),
                             bg="#004c72",
                             fg="white")
    emp_count_spinbox = tk.Spinbox(left_panel,
                                   font=font.Font(
                                       family='Copperplate Gothic Bold',
                                       size=15),
                                   from_=1,
                                   to=3)
    emp_count_window.add(emp_count_lbl)
    emp_count_window.add(emp_count_spinbox)

    add_project_btn = tk.Button(
        left_panel,
        text="Add Project",
        font=font.Font(family='Copperplate Gothic Bold', size=15),
        command=lambda: dump_details(category="project",
                                     data={
                                         "name": p_name_val.get(),
                                         "language": p_lang_val.get(),
                                         "domain": p_domain_val.get(),
                                         "type": p_type_val.get(),
                                         "emp_count": emp_count_spinbox.get()
                                     }))
    left_panel.add(add_project_btn)

    # -------------------------------------------------RIGHT PANEL------------------------------------------------------
    right_panel = tk.PanedWindow(main_panel, orient=tk.VERTICAL, bg="#F5F5F5")
    main_panel.add(right_panel)

    refresh_btn = tk.Button(right_panel,
                            anchor=tk.N,
                            text="Refresh",
                            font=font.Font(family='Copperplate Gothic Bold',
                                           size=15),
                            command=lambda: refresh(root))
    right_panel.add(refresh_btn)

    clear_btn = tk.Button(right_panel,
                          anchor=tk.N,
                          text="Clear",
                          font=font.Font(family='Copperplate Gothic Bold',
                                         size=15),
                          command=lambda: refresh(root, clear=True))
    right_panel.add(clear_btn)

    allotments, emp_allotted, project_count = allot_projects()

    add_result_map(right_panel, allotments)

    # Add a pie chart showing how many assignments were done
    # and how many are still left.
    if len(allotments) > 0:
        fig = plt.Figure(figsize=(1, 1))
        ax = fig.add_axes([0, 0, 1, 1])
        chart_type = FigureCanvasTkAgg(fig, right_panel)
        right_panel.add(chart_type.get_tk_widget())
        ax.axis('equal')
        students = [emp_allotted, project_count - emp_allotted]
        ax.pie(students, colors=["#008400", "#b30000"])

    root.mainloop()
예제 #4
0
center_window(root, 270, 120)
btn_select = tk.Button(root,
                       text='Select Pack',
                       width=50,
                       height=50,
                       command=selectPack)
btn_select.pack()
res_win = tk.Toplevel(root)
res_win.title("Set Resolution")
res_win.iconbitmap(resource_path('favicon.ico'))
res_win.resizable(width=False, height=False)
center_window(res_win, 270, 80)
''' resolution ratio set'''
res_r = tk.IntVar()
res_r.set(1)
slider_res = tk.PanedWindow(res_win)
slider_res.pack(fill=tk.BOTH, expand=1)
slider_label = tk.Label(res_win, text='resolution: 16X')
slider_scale = tk.Scale(res_win,
                        from_=0,
                        to=6,
                        orient=tk.HORIZONTAL,
                        variable=res_r,
                        command=show_values)

slider_res.add(slider_label)
slider_res.add(slider_scale)

btn_start = tk.Button(res_win,
                      text='Confirm',
                      width=60,
예제 #5
0
get_keys(tk.Canvas())
get_keys(tk.Checkbutton())
get_keys(tk.Entry())
get_keys(tk.Frame())
get_keys(tk.Label())
get_keys(tk.Listbox())
get_keys(tk.Menubutton())
get_keys(tk.Menu())
get_keys(tk.Message())
get_keys(tk.Radiobutton())
get_keys(tk.Scale())
get_keys(tk.Scrollbar())
get_keys(tk.Text())
get_keys(tk.Toplevel())
get_keys(tk.Spinbox())
get_keys(tk.PanedWindow())
get_keys(tk.LabelFrame())


# ---------------- tkinter widget key values -------------------

# To find out what arguments are accepted by a widget,
# together with the default/current values, use .config() without any options.
# This returns a dictionary of the allowed arguments which can then be printed out.
#
# The first entry (lowercase) is the option name
# The second item (camelCase) is the option name for database lookuo,
# The third entry (Titlecase) is the option class for database lookup,
# The fourth entry is the default value,
# The fifth item is the current value.
#
예제 #6
0
    def __init__(self, parent, appClass):
        tk.Frame.__init__(self, parent, height=myFrameHeight, width=myFrameWidth)

        self.noOfLinesAllowed=5000.0
        self.stopAutoScroll = False
        self.timeCalledDB = 0

        #btBackgroundColor = '#362F2F'
        btBackgroundColor = '#f0a30a'
        # main frames

        self.panedwindow = tk.PanedWindow(self, orient=tk.VERTICAL, showhandle = True, height=myFrameHeight, width=myFrameWidth)
        self.panedwindow.pack(fill=tk.BOTH, expand=True)

        self.top_frame = tk.Frame(self.panedwindow, background='white', height=(myFrameHeight)*0.7,width=myFrameWidth,  highlightthickness=0, relief=tk.FLAT)
        self.bottom_frame = tk.Frame(self.panedwindow, background='white', width=myFrameWidth,  highlightthickness=0, relief=tk.FLAT)
        self.top_frame.pack_propagate(0)
        self.top_frame.pack(side=tk.TOP, fill=tk.BOTH, expand=True, padx=0, pady=0)
        self.bottom_frame.pack_propagate(0)
        self.bottom_frame.pack(side=tk.TOP, fill=tk.BOTH, expand=True, padx=0, pady=0)
        self.panedwindow.add(self.top_frame)
        self.panedwindow.add(self.bottom_frame)

        # Button Frame in top frame
        Frame2 = tk.Frame(self.top_frame,  highlightthickness=0, relief=tk.FLAT)
        Frame2.configure(borderwidth="3")
        Frame2.configure(background=btBackgroundColor)
        Frame2.configure(highlightbackground=btBackgroundColor)
        Frame2.configure(highlightcolor=btBackgroundColor)
        Frame2.pack(side=tk.RIGHT, fill=tk.BOTH,  padx=0, pady=0)

        # right buttons in top frame
        ButtonSaveReceived = Metro_Button(Frame2,text="Save To File", command=lambda: self.ButtonSaveReceived_click(appClass), background=btBackgroundColor)
        ButtonSaveReceived.config(width=12)
        ButtonSaveReceived.pack()

        self.ButtonToggleScroll = Metro_Button(Frame2,text="Stop", command=lambda: self.ButtonChangeAutoScroll_click(appClass), background=btBackgroundColor)
        self.ButtonToggleScroll.config(width=12)
        self.ButtonToggleScroll.pack()

        self.ButtonBack1 = Metro_Button(Frame2,text="Back To Main", command=lambda: self.ButtonBackToMain_click(appClass), background=btBackgroundColor)
        self.ButtonBack1.config(width=12)
        self.ButtonBack1.pack(side=tk.BOTTOM)


        # scrolled text box used to display the serial data
        # Vertical (y) Scroll Bar
        ScrolltxtConsoleRecu = tk.Scrollbar(self.top_frame,  highlightthickness=0, relief=tk.FLAT)
        ScrolltxtConsoleRecu.pack(side=tk.RIGHT, fill=tk.Y)
        # Text Widget
        self.txtConsoleRecu = tk.Text(self.top_frame, width=1, height=1, yscrollcommand=ScrolltxtConsoleRecu.set,  highlightthickness=0, relief=tk.FLAT)
        self.txtConsoleRecu.pack(side=tk.LEFT, fill=tk.BOTH, expand=True, padx=0, pady=0)
        # Configure the scrollbars
        ScrolltxtConsoleRecu.config(command=self.txtConsoleRecu.yview)


        # bottom box L and R
        self.bottom_frame_L = tk.Frame(self.bottom_frame, background='white', height=1,width=1,  highlightthickness=0, relief=tk.FLAT)
        self.bottom_frame_R = tk.Frame(self.bottom_frame, background='white', height=1,width=1,  highlightthickness=0, relief=tk.FLAT)
        self.bottom_frame_R.pack(side = tk.RIGHT, fill=tk.BOTH, expand=True, padx=0, pady=0)
        self.bottom_frame_L.pack(side = tk.LEFT, fill=tk.BOTH, expand=True, padx=0, pady=0)
        self.bottom_frame_L.pack_propagate(0)
        self.bottom_frame_R.pack_propagate(0)


        # box left bottom
        # Vertical (y) Scroll Bar
        ScrollTxtRecu = tk.Scrollbar(self.bottom_frame_L,  highlightthickness=0, relief=tk.FLAT)
        ScrollTxtRecu.pack(side=tk.RIGHT, fill=tk.Y)
        # Text Widget
        self.txtRecu = tk.Text(self.bottom_frame_L, wrap=tk.NONE,  yscrollcommand=ScrollTxtRecu.set,  highlightthickness=0, relief=tk.FLAT)
        self.txtRecu.pack(side=tk.LEFT,  fill=tk.BOTH, expand=True, padx=0, pady=0)
        # Configure the scrollbars
        ScrollTxtRecu.config(command=self.txtRecu.yview)

        # box rigth bottom which includes the sent data
        ScrollTxtSend = tk.Scrollbar(self.bottom_frame_R,  highlightthickness=0, relief=tk.FLAT)
        ScrollTxtSend.pack(side=tk.RIGHT,  fill=tk.Y)
        # Text Widget
        self.txtSend = tk.Text(self.bottom_frame_R, wrap=tk.NONE,  yscrollcommand=ScrollTxtRecu.set,  highlightthickness=0, relief=tk.FLAT)
        self.txtSend.pack(side=tk.LEFT, fill=tk.BOTH, expand=True, padx=0, pady=0)
        # Configure the scrollbars
        ScrollTxtSend.config(command=self.txtSend.yview)

        self.txtSend.bind('<Double-Button-1>', self.SendDBClick)
        self.bind("<Configure>", self.configureEvent)

        self.txtSend.insert(tk.END, '\n')
        self.txtSend.insert(tk.END, 'Help\n')
        self.txtSend.insert(tk.END, 'Auto\n')
        self.txtSend.insert(tk.END, 'Manual\n')
        self.txtSend.insert(tk.END, 'History\n')
        self.txtSend.insert(tk.END, 'Bat\n')
        self.txtSend.insert(tk.END, 'Error\n')
        self.txtSend.insert(tk.END, 'Reset\n')
예제 #7
0
import tkinter as tk

x = 1


def test():
    global x
    bottomframe.insert((1.0), "line number " + str(x) + "\n")
    x += 1


root = tk.Tk()

TAB = tk.PanedWindow(root, orient=tk.VERTICAL)
TAB.grid(sticky='nsew')

LAR = tk.PanedWindow(root, orient=tk.HORIZONTAL)
LAR.grid(sticky='nsew')

TAB.add(LAR)

leftpane = tk.Label(LAR, text='Left Pane')
LAR.add(leftpane)

rightpane = tk.Button(LAR, text="Right Pane", command=test)
LAR.add(rightpane, stretch="always")

frame = tk.Frame(TAB)
frame.grid(sticky='nsew')
frame.grid_columnconfigure(0, weight=1)
frame.grid_rowconfigure(0, weight=1)
예제 #8
0
import logging
import tkinter as tk
from tkinter import ttk

logging.basicConfig(level=logging.CRITICAL, format='%(levelname)-9s: %(name)s : %(funcName)s() : %(message)s')
log = logging.getLogger('nested_paned_window')
log.setLevel(logging.DEBUG)


if __name__ == '__main__':
    master = tk.Tk()
    master.title = 'Nested Paned Windows'
    
    outer_panes = tk.PanedWindow(master)
    outer_panes.pack(fill=tk.BOTH, expand=1)

    right = tk.Label(outer_panes, text="right pane")
    inner_panes = tk.PanedWindow(outer_panes, orient=tk.VERTICAL)
    
    
    outer_panes.add(inner_panes)
    outer_panes.add(right)

    top = tk.Label(inner_panes, text="top pane")
    inner_panes.add(top)

    bottom = tk.Label(inner_panes, text="bottom pane")
    inner_panes.add(bottom)

    master.mainloop()
예제 #9
0
	def initStockPanel(self):		
		# the area where we will enter text
		m1 = tk.PanedWindow(width=100)
		m1.pack(fill=tk.X,side=tk.TOP)

		m3 = tk.PanedWindow(m1, orient=tk.VERTICAL)
		
		m4 = tk.PanedWindow(m3)
		m3.add(m4)
		self.searchText = tk.Text(width=25, height=1,bg='white',font="calibri 12 bold")
		searchBtn = tk.Button(text ="  Search..  ",command = self.searchClick);
		searchBtn.config(fg = "white",font="calibri 14 bold",bg='midnight blue',relief=tk.RAISED)
		m4.add(self.searchText)
		m4.add(searchBtn)
#label for logo ********************
		# logoLabel = tk.Label(width=30)
		# logoLabel.place(x=5, y=160)  
		# image=img,
		
		m1.add(m3)
		self.infoPanel = tk.PanedWindow(m1, orient=tk.VERTICAL)
		m3.add(self.infoPanel)

		#m1.add(m3)


#****************************************************************

		m2 = tk.PanedWindow(m1, orient=tk.VERTICAL)
		m1.add(m2)

		addBtn = tk.Button(text ="Stock Price",font="calibri 14 bold",width=20,fg='white',bg='steel blue',command = self.stockPriceClick)
		m2.add(addBtn)

		f = tk.Frame(height=5, width=32,pady=20)
		#f.pack_propagate(0) # don't shrink
		f.pack(fill=tk.X,side=tk.TOP)

		updateBtn = tk.Button(f ,text ="Company History",font="calibri 14 bold",fg='white',bg='steel blue' ,command = self.compHistory)
		updateBtn.pack(fill=tk.X, side=tk.TOP)
		m2.add(f)

		fDel = tk.Frame(height=5, width=32,pady=20)
		#f.pack_propagate(0) # don't shrink
		fDel.pack(fill=tk.X,side=tk.TOP)

		deleteButton = tk.Button(fDel ,text ="Relevant Analysis",font="calibri 14 bold",fg='white',bg='steel blue',
		command = self.relAnalysis);
		deleteButton.pack(fill=tk.X, side=tk.TOP)
		m2.add(fDel)

#newly added buttons******************************************
		news=tk.Frame(height=5,width=32,pady=20)
		news.pack(fill=tk.X,side=tk.BOTTOM)
		

		newsButton= tk.Button(news ,text ="Latest News",font="calibri 14 bold",fg='white',bg='steel blue',
		command = self.lateNews);
		newsButton.pack(fill=tk.X,side=tk.BOTTOM)
		m2.add(news)

		trend=tk.Frame(height=5,width=32,pady=20)
		trend.pack(fill=tk.X,side=tk.BOTTOM)

		trendButton= tk.Button(trend ,text ="Industry Trend",font="calibri 14 bold",fg='white',bg='steel blue',
		command = self.indusTrend);
		trendButton.pack(fill=tk.X,side=tk.BOTTOM)
		m2.add(trend)

		saveInfo= tk.Frame(height=5, width=32,pady=20)
		saveInfo.pack(fill=tk.X,side=tk.BOTTOM)

		saveButton = tk.Button(saveInfo ,text ="Save Search Result", font="calibri 14 bold",fg="white",bg="midnight blue",
		command=self.saveRes);
		saveButton.pack(side=tk.BOTTOM)
		m2.add(saveInfo)
예제 #10
0
    def __init__(self, parent, controler):
        tk.Frame.__init__(self, parent)
        # add side frame for notes, one frame for a list of tasks.
        active_project_lable = tk.Label(
            self,
            text=f'Customer: <{current_customer.name}>'
            f' Project: <{current_project.project_name}>')

        # define the notebook its windows and
        task_note = ttk.Notebook(self)
        task_list_frame = ttk.Frame(task_note)
        search_task_frame = ttk.Frame(task_note)
        add_task_frame = ttk.Frame(task_note)
        task_note.add(task_list_frame, text='Task List')
        task_note.add(search_task_frame, text='Search Tasks')
        task_note.add(add_task_frame, text='Add Tasks')

        task_note.grid(row=1, column=0, stick='nesw')

        # add task
        task_label_list = [
            'Project ID',
            'Task Description',
            'Task MES Lead',
            'Task Triage',
        ]
        entry = {}
        label = {}
        for i, name in enumerate(task_label_list):
            e = tk.Entry(add_task_frame)
            entry[name] = e

            if name == 'Task Description':
                e.grid(sticky='ew', column=1, columnspan=3)

            elif name != 'Task Description':
                e.grid(sticky='e', column=1)

            lb = tk.Label(add_task_frame, text=name)
            lb.grid(row=i, column=0, sticky='w')

            label[name] = lb

        pick_start_date_label = ttk.Label(add_task_frame, text='Start Date')
        pick_end_date_label = ttk.Label(add_task_frame, text='End Date')
        pick_start_date_label.grid(row=5, column=0, sticky='w')
        pick_end_date_label.grid(row=6, column=0, sticky='w')
        pick_start_date_entry = DateEntry(add_task_frame)
        pick_end_date_entry = DateEntry(add_task_frame)
        pick_start_date_entry.grid(row=5, column=1, sticky='e')
        pick_end_date_entry.grid(row=6, column=1, sticky='e')

        #define buttons, etc on the add tasks page
        add_task_button = ttk.Button(add_task_frame,
                                     text='Add Task',
                                     command=lambda: add_task_to_db(entry))
        take_task_button = ttk.Button(add_task_frame,
                                      text='Take Current',
                                      command=lambda: take_current())
        find_project_for_task_button = ttk.Button(add_task_frame,
                                                  text='Search')
        clear_all_tasks_info_button = ttk.Button(
            add_task_frame,
            text='Clear all entrys',
            command=lambda: clear_task_entrys())

        #grid the buttons etc add task Page
        add_task_button.grid(row=7, column=0, columnspan=2, stick='nsew')
        take_task_button.grid(row=0, column=2)
        find_project_for_task_button.grid(row=0, column=3)
        clear_all_tasks_info_button.grid(row=8,
                                         column=0,
                                         columnspan=2,
                                         stick='nsew')

        #define panned window on list tasks frame
        button_bar_frame = tk.Frame(task_list_frame,
                                    height=25,
                                    bg='light sea green')
        button_bar_frame.grid(row=0, column=0, sticky='nsew', columnspan=11)
        task_panned = tk.PanedWindow(task_list_frame)

        task_panned.grid(row=1, column=1, stick='NSEW', columnspan=10)
        frame_panned_left = ttk.Frame(task_list_frame, height=300, width=200)
        text_panned_right = tk.Text(task_panned, height=100, width=100)
        frame_panned_left.grid()

        canvas_panned_left = tk.Canvas(frame_panned_left,
                                       height=510,
                                       width=220)
        display_task_frame = tk.Frame(canvas_panned_left)
        scroll_task_list = tk.Scrollbar(frame_panned_left,
                                        orient='vertical',
                                        command=canvas_panned_left.yview)
        canvas_panned_left.configure(yscrollcommand=scroll_task_list.set)

        scroll_task_list.pack(side='right', fill='y')
        canvas_panned_left.pack(side='left', fill='both', expand=True)
        canvas_panned_left.create_window((4, 4),
                                         window=display_task_frame,
                                         anchor='nw')

        task_panned.add(frame_panned_left)
        task_panned.add(text_panned_right)

        #make eveents for when display task frame or childres has focus
        display_task_frame.bind('<Enter>',
                                lambda event, canvas=canvas_panned_left:
                                _bound_to_mousewheel(event, canvas))
        display_task_frame.bind('<Leave>',
                                lambda event, canvas=canvas_panned_left:
                                _unbind_from_mousewheel(event, canvas))

        display_task_frame.bind('<Configure>',
                                lambda event, canvas=canvas_panned_left:
                                costom_config_canvas(canvas))
        #display_task_frame.bind('<MouseWheel>',lambda event, canvas =canvas_panned_left:_bound_to_mousewheel(event,canvas))
        #display_task_frame.bind('<Down>',lambda event: canvas_panned_left.yview(1,"units"))

        #make buttons etc for list tasks
        list_task_label = ttk.Label(
            button_bar_frame,
            text=
            "List tasks with triage or triage's comma separated list: P,L,A")
        list_task_entry = ttk.Entry(button_bar_frame)
        list_task_lead_label = ttk.Label(
            button_bar_frame,
            text="Chose Mes task lead: #, 'all mes' Or 'all' ")
        list_task_lead_entry = ttk.Entry(button_bar_frame)
        list_task_search_contact_button = ttk.Button(
            button_bar_frame,
            text='Search for name',
            command=lambda: search_contact())
        list_task_button = ttk.Button(button_bar_frame,
                                      text='List Tasks',
                                      command=lambda: list_tasks())

        #grid the button for list tasks
        list_task_label.grid(row=1, column=1)
        list_task_entry.grid(row=1, column=2)
        list_task_entry.insert(0, "P,L")
        list_task_lead_label.grid(row=1, column=3)
        list_task_lead_entry.grid(row=1, column=4)
        list_task_lead_entry.insert(0, 'all mes')
        list_task_search_contact_button.grid(row=1, column=5)
        list_task_button.grid(row=1, column=6)

        # function definitions
        def search_contact():
            print(
                'not yet implemented, will eventually search for the name of the contact, then pull its id into the box'
            )

        def add_task_to_db(entry_list):
            # take all the info enterd into the fields and pass to save to db method
            # need to convert the dates into the correct ISO
            start_date = pick_start_date_entry.get()
            print(convert_date_postgres(start_date, 'i'))

            new_task = Tasks(
                entry_list['Project ID'].get(),
                entry_list['Task Description'].get(),
                entry_list['Task MES Lead'].get(),
                convert_date_postgres(pick_start_date_entry.get(), 'i'),
                convert_date_postgres(pick_end_date_entry.get(), 'i'),
                '',
                entry_list['Task Triage'].get(),
                '',
            )

            new_task.save_to_db()

        def take_current():
            # take the currentley selected project as the project id
            project_id_entry_var = tk.StringVar()
            entry['Project ID'].config(textvariable=project_id_entry_var)
            global current_project
            project_id_entry_var.set(current_project.project_id)

        def clear_task_entrys():
            #clear all info from the task entrys
            for entry_var in task_label_list:
                entry[entry_var].delete(0, 'end')
            pick_end_date_entry.delete(0, 'end')
            pick_start_date_entry.delete(0, 'end')

        def pop_up_cal():
            # make a window pop up with a calander, return to the sender the date picked
            win = tk.Toplevel()
            win.wm_title('Choose Calander')

            start_date_cal = Calendar(win)
            start_date_cal.grid()

        def list_tasks():

            # get the input from the entry
            # get the matrix memeber or other to search for
            # pass to the class method and return a list to display
            # task owner wants to be global, searchable on the contacts page
            global task_frame_count

            user_triage = list_task_entry.get()
            task_owner_or_owners = list_task_lead_entry.get()
            list_of_tasks = Tasks.get_tasks_by_triage(task_owner_or_owners,
                                                      user_triage)

            # clear the frames generated previosey
            if len(task_frame_count) != 0:
                try:
                    for _ in task_frame_count:
                        _.grid_forget()
                        _.destroy()
                except:
                    print('tcl error no frames to delete')

            # get the projects title and ID from the task, display it after the task tilte
            # clear the elements in the tree view
            #loop through all the tasks and add the to the tree view,
            task_frame_count = []
            for i, task in enumerate(list_of_tasks):
                i_int = i
                i = task_display_frame(task, display_task_frame, 'head_only')
                i.grid(row=i_int, column=0)
                task_frame_count.append(i)

            #update the scroll bar

            canvas_panned_left.configure(
                scrollregion=canvas_panned_left.bbox('all'))

        def display_task_list(task_list, orderby, task_or_project_focus):
            '''
            a fuction to display the given tasks, ordering by input and biasing task or projects
            :param task_list: list of tasks to display
            :param orderby is the way to order the tasks
            :param task_or_project_focus: will the list focus on tasks or projects
            :return:
            '''

        def task_display_frame(item, frame_to_display_on, starting_state,
                               *args):
            '''
            build a frame to whitch we pass a task item, the tasks list is built from these frames
            the frame consists of header with basic info about the task and project, a button to expand the header
            showing greater detail about the task, task and project info should be able to be modified from this frame

            :param item: is the task item we wish to display
            :param args: are other arguments not yet decided such as order, color, info to dispaly
            :param starting_state: what state to start in, expanded, colored etc
            :return: a frame onto the task page,
            '''

            frame = ttk.Frame(frame_to_display_on)
            frame_header = ttk.Label(
                frame,
                text=
                f'{item.task_description} <-> {format_day_tasks(item.task_end_date)} <->'
            )
            expand_frame_button = tk.Button(frame,
                                            text='+',
                                            height=0,
                                            width=0,
                                            command=lambda: expand_frame(item))
            frame_header.grid(row=0, column=0)
            expand_frame_button.grid(row=0, column=1)

            def expand_frame(task):
                # make a new function to disaplay a task in full view, contaning all info that is editible
                # get all info for the customer, the project, contacts etc.
                project_for_frame = Projects.find_project(
                    task.project_id, 'project_id')[0]
                customer_for_frame = Customer.find_customer(
                    project_for_frame.customer_id, 'id')[0]

                task_win = tk.Toplevel()
                task_win.wm_title(
                    f'{task.task_description} :---: {project_for_frame.project_name} :---: {customer_for_frame.name} :---:'
                )

                task_frame = ttk.Frame(task_win)
                #add some meaningfull info to the frame, make it editible and saveable to the database,

                #section for the customer
                #key contact deets, add contact to customer, change contact deets
                project_lable_frame = ttk.LabelFrame(task_frame,
                                                     text='Project')
                project_lable_frame.grid(row=0, column=0)
                customer_lable_frame = ttk.LabelFrame(task_frame,
                                                      text='Customer',
                                                      padding=14.7)
                customer_lable_frame.grid(row=1, column=0)

                #get all the labels from customer
                #add allthe names and items to a dictinarry
                #make entrys (labeled - properley) for all relevetn customer items
                customer_labels = [
                    'customer_name',
                    'customer_address',
                    'customer_postcode',
                    'customer_phone',
                    'customer_mobile',
                    'customer_email',
                    'customer_type',
                    'customer_id',
                ]
                customer_entry = {}
                customer_entry_label = {}

                for i, _name in enumerate(customer_labels):
                    e = ttk.Entry(customer_lable_frame)
                    entry[_name] = e
                    e.grid(sticky='e', column=1)
                    lb = ttk.Label(customer_lable_frame,
                                   text=_name[9:].title())
                    lb.grid(row=i, column=0, sticky='w')
                    e.insert(0, getattr(customer_for_frame, f'{_name[9:]}'))

                    project_labels = {
                        'Project Name': 'project_name',
                        'Project Reference': 'project_reference',
                        'Project Address': 'project_address',
                        'Project Postcode': 'project_postcode',
                        'Primary Contact': 'primary_contact',
                        'Project Type': 'project_type',
                        'Project Price Approx': 'project_price_approx',
                        'Project Expected Profit': 'project_expected_profit',
                        'Project Triage': 'project_triage',
                        'Project Lead MES': 'project_lead_mes',
                    }

                for i, _name in enumerate(project_labels.keys()):
                    e = ttk.Entry(project_lable_frame)
                    entry[_name] = e
                    e.grid(sticky='e', column=1)
                    lb = ttk.Label(project_lable_frame, text=_name[8:])
                    lb.grid(row=i, column=0, sticky='w')
                    # make something to convert list names to actual

                    e.insert(0,
                             getattr(project_for_frame, project_labels[_name]))

                #customer_name_entry.insert(0,customer_for_frame.name)

                task_frame.grid()

            return frame

        def costom_config_canvas(canvas):
            #binds scrol to the canvas
            canvas.configure(scrollregion=canvas.bbox('all'))

        def _bound_to_mousewheel(event, canvas):
            'mouse wheel as scroll bar'
            canvas.bind_all(
                '<MouseWheel>',
                lambda event, canvas=canvas: _on_mousewheel(event, canvas))

        def _unbind_from_mousewheel(event, canvas):
            canvas.unbind_all('<MouseWheel>')

        def _on_mousewheel(event, canvas):
            #make canvas scroll sensibley
            canvas.yview_scroll(int(-1 * (event.delta / 70)), 'units')
예제 #11
0
root = tk.Tk()
root.title('HandwritingRecognition')

photoLabel = tk.Label(root,bg='black')
photoLabel.bind('<Button-1>',drawInput)
photoLabel.bind('<B1-Motion>',drawInput)
photoLabel.pack()
root.config(cursor="arrow")

displayImg()

buttonReset = tk.Button(root,text='重置手写输入窗口',command=reset,font=('宋体',16))
buttonReset.pack(expand=True,fill="both",padx=5,pady=5)

paned1 = tk.PanedWindow(root)
paned1.pack(expand=True,fill="both")

paned2 = tk.PanedWindow(root)
paned2.pack(expand=True,fill="both")

paned3 = tk.PanedWindow(root)
paned3.pack(expand=True,fill="both")

buttonRecognition = tk.Button(paned1,text='识别当前手写数字',command=recognitionCurrent,font=('宋体',16))
paned1.add(buttonRecognition)
buttonRecognition.pack(side=tk.LEFT,expand=True,fill="both",padx=5,pady=5)

buttonTrainCurrent = tk.Button(paned1,text='训练当前手写数字',command=trainCurrent,font=('宋体',16))
paned1.add(buttonTrainCurrent)
buttonTrainCurrent.pack(side=tk.RIGHT,expand=True,fill="both",padx=5,pady=5)
예제 #12
0
if __name__ == '__main__':
    root = tk.Tk()
    root.wm_title("Factoriel Pixel - CNC")
    root.geometry("%dx%d+0+0" % (root.winfo_screenwidth(), root.winfo_screenheight()))
    root.tk_setPalette(background='#303030', foreground='#636363', activeBackground='#636363', activeForeground='#636363')
    root.protocol("WM_DELETE_WINDOW", root.quit)

    controller = CNCController(root)

    photo = ImageTk.PhotoImage(Image.open("resources/FP_Banner.png"))
    banner = tk.Label(image=photo, bg="white", width=root.winfo_screenwidth())
    banner.pack()
    banner.pack()

    m1 = tk.PanedWindow(bg="#303030")
    m1.pack(fill=tk.BOTH, expand=1)

    m2 = tk.PanedWindow(m1, orient=tk.VERTICAL, bg="#303030")

    top = tk.LabelFrame(m2, text="CNC Position", font=("Helvetica", 16))

    scene = Scene(top, root, controller)
    scene.pack(side=tk.TOP, fill=tk.BOTH, expand=1)

    cncPosition = CNCPosition(top, root, controller)
    cncPosition.pack(side=tk.TOP, fill=tk.BOTH, expand=1)

    left = tk.LabelFrame(m1, text="Controls", padx=5, pady=5, font=("Helvetica", 16))

    automaticControlFrame = AutomaticControlsFrame(left, controller, scene, padx=5, pady=5)
예제 #13
0
파일: winDbUp.py 프로젝트: derris/djFrame
 def createWidgets(self):
     top = self.winfo_toplevel()
     top.rowconfigure(0, weight=1)
     top.columnconfigure(0, weight=1)
     ######################### 行
     l_row1 = 0
     l_row2 = 1
     l_row3 = 2
     self.rowconfigure(l_row1, weight=0)
     self.rowconfigure(l_row2, weight=1)
     self.rowconfigure(l_row3, weight=0)
     ######################### 列
     l_col1 = 0
     l_col2 = 1
     self.columnconfigure(l_col1, weight=0)
     self.columnconfigure(l_col2, weight=1)
     ########################## l_row1 l_col1
     self.panes1 = tk.PanedWindow(self, orient=tk.HORIZONTAL, height=30)
     self.textDir = tk.Text(self.panes1, width=20)
     self.textDir.insert(0.0, g_cwd)
     self.panes1.add(self.textDir)  # 当前目录               ##### 列出当前目录下文件
     self.panes1.add(
         tk.Button(self.panes1, text="列出", command=self.click_listfile))
     self.panes1.grid(row=l_row1, column=l_col1, sticky=tk.E + tk.W)
     ########################## l_row1 l_col2
     self.panes2 = tk.PanedWindow(self, orient=tk.HORIZONTAL, height=30)
     self.panes2.add(
         tk.Button(self.panes2,
                   text=" 分析 ",
                   width=6,
                   command=self.click_analyze))  #
     self.textS1 = tk.Text(self.panes2, width=5)
     self.textS1.insert(0.0, "0")
     self.panes2.add(self.textS1)  # 执行范围1
     self.panes2.add(tk.Label(self.panes2, text="到", width=3,
                              anchor=tk.W))  # label
     self.textS2 = tk.Text(self.panes2, width=5)
     self.textS2.insert(0.0, "0")
     self.panes2.add(self.textS2)  # 执行范围2              #####  执行文件
     self.panes2.add(
         tk.Button(self.panes2,
                   text=" 执行 ",
                   width=6,
                   command=self.click_execute))  #
     #
     self.panes2.grid(row=l_row1,
                      padx=(5, 0),
                      column=l_col2,
                      sticky=tk.E + tk.W)
     self.panes2.add(tk.Label(self.panes2, text=""))  # 占位置
     ########################## l_row2 l_col1
     self.ListFile = tk.Listbox(self)  #, selectmode = tk.MULTIPLE)
     #
     self.ListFile.grid(row=l_row2,
                        column=l_col1,
                        sticky=tk.E + tk.W + tk.N + tk.S)
     ##########################  l_row2 l_col2
     self.tab = ttk.Notebook(self)
     # tab1
     self.tab1 = ttk.PanedWindow(self, orient=tk.HORIZONTAL)
     self.textSql = tk.Text(self.tab1)  ######### sql文件内容。
     self.textSql_sv = ttk.Scrollbar(self.tab1,
                                     orient=tk.VERTICAL,
                                     command=self.textSql.yview)
     self.textSql['yscrollcommand'] = self.textSql_sv.set
     self.tab1.add(self.textSql, weight=1)
     self.tab1.add(self.textSql_sv, weight=0)
     self.tab.add(self.tab1)
     # tab2
     self.tab2 = ttk.PanedWindow(self, orient=tk.HORIZONTAL)
     self.textAnalyze = tk.Text(self.tab2)  ######### sql分析内容。
     self.textAnalyze_sv = ttk.Scrollbar(self.tab2,
                                         orient=tk.VERTICAL,
                                         command=self.textAnalyze.yview)
     self.textAnalyze['yscrollcommand'] = self.textAnalyze_sv.set
     self.tab2.add(self.textAnalyze, weight=1)
     self.tab2.add(self.textAnalyze_sv, weight=0)
     self.tab.add(self.tab2)
     #tab3
     self.tab3 = ttk.PanedWindow(self, orient=tk.HORIZONTAL)
     self.textResult = tk.Text(self.tab3)  ######### execute内容。
     self.textResult_sv = ttk.Scrollbar(self.tab3,
                                        orient=tk.VERTICAL,
                                        command=self.textResult.yview)
     self.textResult['yscrollcommand'] = self.textResult_sv.set
     self.tab3.add(self.textResult, weight=1)
     self.tab3.add(self.textResult_sv, weight=0)
     self.tab.add(self.tab3)
     #table
     self.tab.tab(0, text=' sql内容 ')
     self.tab.tab(1, text=' 文件分析 ')
     self.tab.tab(2, text=' 执行结果 ')
     self.tab.grid(row=l_row2,
                   column=l_col2,
                   padx=(5, 0),
                   sticky=tk.E + tk.W + tk.N + tk.S)
     ##########################  l_row3 l_col1
     self.read = tk.Button(self, text='  读出  ', command=self.click_read)
     self.read.grid(row=l_row3, column=l_col1, sticky=tk.E)
     ##########################  l_row3 l_col2
     self.quit = tk.Button(self, text='  退出  ', command=self.quit)
     self.quit.grid(row=l_row3, column=l_col2, sticky=tk.E)
        if toGif.get() == False:
            img.save(saveName + ".png", 'PNG')
        else:
            # TODO : Finir la conversion propre en parcourant la palette pour trouver la couleur clef
            # TODO : Remâcher l'image générée pour remplacer (avec moiré?) la couche alpha par une couleur pure pour la conversion
            print(img.getpalette())
            img.save(saveName + ".gif", 'GIF', transparency=0)


#===============================================================================
# GUI

window = Tk.Tk()
print("Main")
p_main = Tk.PanedWindow(window, orient="vertical")
p_main.pack(side="top", expand="yes", fill="both", padx=2, pady=2)

# Container for the file
lf_files = Tk.LabelFrame(p_main, text="Files", padx=2, pady=2)
p_main.add(lf_files)

inputFile = Tk.StringVar()
inputFile.set("C:\\")
Tk.Label(lf_files, text="Input file").grid(row=1, column=1)
i_inputFile = Tk.Entry(lf_files, textvariable=inputFile)
i_inputFile.grid(row=1, column=2)
b_inputBrowse = Tk.Button(lf_files,
                          text="...",
                          command=lambda: inputFileChoose(inputFile))
b_inputBrowse.grid(row=1, column=3)
예제 #15
0
 def _create(self, **kwargs):
     return tkinter.PanedWindow(self.root, **kwargs)
예제 #16
0
	def stockPriceClick(self):
		self.counter += 1
		t = tk.Toplevel(self,background='steel blue')
		t.title("STOCK PRICE DETAILS AND CHART")
		mainWin= tk.PanedWindow(t,orient=tk.VERTICAL,bg='midnight blue',relief=tk.RAISED)
		mainWin.pack(expand=1)
#finance chart representing 5-day stock price
		textLabel1= tk.Label(mainWin,text="5-day Stock Price Performance",justify="left",bg='steel blue')
		textLabel1.config(bd=6,fg = "white",font="calibri 14 bold")
		textLabel1.pack(side="top",padx=10,pady=10)
		mainWin.add(textLabel1)
		secWin= tk.PanedWindow(mainWin)
		mainWin.add(secWin)
		labelWin = tk.PanedWindow(secWin, orient=tk.VERTICAL,background='steel blue',relief=tk.RAISED)
		secWin.add(labelWin)


#Company name******************		
		cmpnyName,b=stockCrawler.get_name()
		# cmpnyName=''.join(cmpnyName)
		cmpnyLabel=tk.Label(labelWin,text=cmpnyName,justify="left",bg='steel blue')
		cmpnyLabel.config(fg = "black",font="calibri 14 bold")
		cmpnyLabel.pack(side="top",padx=10,pady=10)
		labelWin.add(cmpnyLabel)
#  company stock price********************
		stockPrice=stockCrawler.price
		stkPriceLabel=tk.Label(labelWin,text='Current Price: $'+stockPrice,justify="left",bg='steel blue')
		stkPriceLabel.config(fg = "black",font="calibri 14 bold")
		stkPriceLabel.pack(side="top",padx=10,pady=10)
		labelWin.add(stkPriceLabel)
#The value of price Change Percent********************
		percntgChange=stockCrawler.price_change_rate
		moreInfo=stockCrawler.information
		newMoreInfo=""
		i=1
		InfoDict={1:'Range ',2:'52 week ',3:'Open',4:'Vol/Avg',5:'Mkt cap',6:'P/E',7:'Div/yield',8:'EPS',9:'Shares',10:'Beta',11:'Inst.own'}
		for item in moreInfo:
			title=InfoDict.get(i)
			fullValue=title+":"+item+" "
			newMoreInfo+=fullValue
			i=i+1

		priceChangeLabel=tk.Label(labelWin,text='Price Change {0} :'.format(percntgChange)+"\n"+newMoreInfo,justify="left",bg='steel blue')
		priceChangeLabel.config(fg = "black",font="calibri 14 bold")
		priceChangeLabel.pack(side="top",padx=10,pady=10)
		labelWin.add(priceChangeLabel)

		secWin.add(labelWin)

#### stock price chart (5days) #################

		url = stockCrawler.chart
		with urllib.request.urlopen(url) as u:
			raw_data = u.read()
		im = Image.open(BytesIO(raw_data))
		img=ImageTk.PhotoImage(im)
		imgLabel1 = tk.Label(secWin,image = img,bg='midnight blue',relief=tk.RAISED)
		imgLabel1.image=img

		imgLabel1.pack(side="bottom",padx=10,pady=10)
		secWin.add(imgLabel1)
예제 #17
0
    with open(path) as f:
        text = f.read()
    check_text(text)


if len(sys.argv) > 1:
    try:
        check_file(sys.argv[1])
        print("%s was checked successfully; the proof outline is valid!" %
              (sys.argv[1], ))
    except LocError as e:
        print(e)
else:
    window = tkinter.Tk()
    window.title("Proof Checker")
    panedWindow = tkinter.PanedWindow(window, orient=tkinter.VERTICAL)

    def check_proof():
        text_box.tag_remove('error', '1.0', tkinter.END)
        error_msg_box.delete('1.0', tkinter.END)
        window.update()
        try:
            check_text(text_box.get('1.0', tkinter.END))
            messagebox.showinfo(
                message="Geen fouten gevonden; het bewijs is geldig!")
        except LocError as e:
            (startLine, startCol), (endLine, endCol) = e.loc
            print(e.loc)
            text_box.tag_add(
                'error', '%d.%s' %
                (startLine + 1, 'end' if startCol == -1 else startCol),
예제 #18
0
op_var.trace('w', change_dropdown)

optionmenu.place(x=6, y=2)

# Spin Box
lf_SpinBox = tk.LabelFrame(root, width=96, height=96, text='SpinBox')
lf_SpinBox.grid(row=3, column=2, sticky='w')

spinbox = tk.Spinbox(lf_SpinBox, from_=0, to=10, width=8)
spinbox.place(x=6, y=2)

# Paned Window
lf_PanedWindow = tk.LabelFrame(root, width=570, height=96, text='PanedWindow')
lf_PanedWindow.grid(row=3, column=3, columnspan=3, sticky='w')

panedwindow = tk.PanedWindow(lf_PanedWindow, width=560)

pw_left = tk.Label(panedwindow, text="left pane")
panedwindow.add(pw_left)
pw_mid = tk.Label(panedwindow, text="mid pane")
panedwindow.add(pw_mid)
pw_right = tk.Label(panedwindow, text="right pane")
panedwindow.add(pw_right)

panedwindow.place(x=6, y=2)

# Canvas
lf_Canvas = tk.LabelFrame(root, width=935, height=410, text='Canvas')
lf_Canvas.grid(row=4, column=0, columnspan=6, padx=10, sticky='w')

canvas = tk.Canvas(lf_Canvas, bg='grey', heigh=380, width=900)
예제 #19
0
    def __init__(self, window, window_title, video_source=0):
        self.window = window
        self.window.title(window_title)
        self.video_source = video_source
        self.window.resizable(False, False)
        self.window.geometry("1000x490+450+250")

        self.is_recognize = False
        self.subject_code = ""
        self.student_list = []
        self.student_check_in_list = []
        self.col_names = ['Student_Id', 'Subject_Id', 'Date_Time']
        self.attendance = pd.DataFrame(columns=self.col_names)

        # open video source (by default this will try to open the computer webcam)
        self.vid = MyVideoCapture(self.video_source)

        # Create the whole window panel
        self.m = tkinter.PanedWindow()
        self.m.pack(fill=tkinter.BOTH, expand=1)

        # Create a canvas that can fit the above video source size
        self.canvas = tkinter.Canvas(window, width=self.vid.width, height=self.vid.height)
        self.m.add(self.canvas)

        # Interaction panel
        self.m2 = tkinter.PanedWindow(self.m, orient=tkinter.VERTICAL)
        self.m.add(self.m2)

        # Title
        self.lb_title = tkinter.Label(self.m2, text="Attendance System", font='Monospaced 12 bold')
        self.lb_title.config(background='#446dc7', height=3)
        self.m2.add(self.lb_title)
        # Input class' code
        self.m3 = tkinter.PanedWindow(self.m2, orient=tkinter.HORIZONTAL)
        self.m2.add(self.m3)
        self.lb_text = tkinter.Label(self.m3, text="Enter Class' Code:", width=25, font='Monospaced 10')
        self.lb_text.config(height=2)
        self.m3.add(self.lb_text)
        self.entry_class_code = tkinter.Entry(self.m3, width=25, borderwidth=5, font='Monospaced 10')
        self.m3.add(self.entry_class_code)
        # Start button
        self.btn_start = \
            tkinter.Button(self.m2, text="Start check-in students", width=50, borderwidth=2
                           , font='Monospaced 10 bold', command=self.onStart)
        self.btn_start.config(height=3)
        self.m2.add(self.btn_start)
        # Student's id
        self.lb_student_code = tkinter.Label(self.m2, text="", width=50, font='Monospaced 10')
        self.lb_student_code.config(background='#446dc7', height=3)
        self.m2.add(self.lb_student_code)
        # Scroll log
        self.log_text = tkst.ScrolledText(master=self.m2, wrap=tkinter.WORD, width=50, height=13)
        self.m2.add(self.log_text)
        # Stop button
        self.btn_stop = \
            tkinter.Button(self.m2, text="STOP", width=48, borderwidth=2,
                           font='Monospaced 10 bold', command=self.onStop)
        self.btn_stop.config(height=3)
        self.m2.add(self.btn_stop)

        self.checked_students = {}
        self.checked_student_count = {}
        self.photo_change_student = {}

        # After it is called once, the update method will be automatically called every delay milliseconds
        self.delay = 15
        self.update()
        self.window.mainloop()
예제 #20
0
# furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
 
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

# See: http://effbot.org/tkinterbook/panedwindow.htm
#      http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/panedwindow.html

import tkinter as tk

root = tk.Tk()

paned_window = tk.PanedWindow(root, orient=tk.VERTICAL, sashwidth=2, sashrelief=tk.RIDGE)
paned_window.pack(fill=tk.BOTH, expand=1)

top = tk.Label(paned_window, text="top pane")
paned_window.add(top, minsize=50, height=100, width=200)

bottom = tk.Label(paned_window, text="bottom pane")
paned_window.add(bottom, minsize=50, height=100, width=200)

root.mainloop()
예제 #21
0
    def initUI(self, parent, nbk, treevw, tkApp):
        """
        Initialize window and widgets.
        """
        if self.parent is not None:  # Already initialized
            self.reset()
            self.fillWithDefects()
            self.fillWithRemarks()
            return
        self.tkApp = tkApp
        self.parent = parent
        ### MAIN PAGE FRAME ###
        self.reportFrame = ttk.Frame(parent)

        ### DEFECT TABLE ###
        self.rowHeight = 20
        self.style = ttk.Style()
        self.style.configure('Report.Treeview', rowheight=self.rowHeight)
        # REMARK TREEVW
        self.remarksFrame = ttk.LabelFrame(self.reportFrame,
                                           text="Remarks table")
        self.paned_remarks = tk.PanedWindow(self.remarksFrame,
                                            orient=tk.VERTICAL,
                                            height=900)
        self.remarkframeTw = ttk.Frame(self.paned_remarks)
        self.remarks_treevw = ttk.Treeview(self.remarkframeTw,
                                           style='Report.Treeview',
                                           height=0)
        self.remarks_treevw["columns"] = ["Title", "Type"]
        self.remarks_treevw.heading("#0", text='Title', anchor=tk.W)
        self.remarks_treevw.column("#0", width=150, anchor=tk.W)
        self.remarks_treevw.bind("<Delete>", self.deleteSelectedRemarkItem)

        self.remarks_treevw.grid(row=0, column=0, sticky=tk.NSEW)
        scbVSel = ttk.Scrollbar(self.remarkframeTw,
                                orient=tk.VERTICAL,
                                command=self.remarks_treevw.yview)
        self.remarks_treevw.configure(yscrollcommand=scbVSel.set)
        scbVSel.grid(row=0, column=1, sticky=tk.NS)
        self.remarkframeTw.columnconfigure(0, weight=1)
        self.remarkframeTw.rowconfigure(0, weight=1)
        self.remarkframeTw.pack(side=tk.TOP,
                                fill=tk.BOTH,
                                pady=5,
                                expand=1,
                                padx=5)
        frameAllBelow = ttk.Frame(self.paned_remarks)
        frameBtnRemarks = ttk.Frame(frameAllBelow)
        btn_addRemark = ttk.Button(frameBtnRemarks,
                                   text="Add remark",
                                   command=self.addRemarkCallback)
        btn_addRemark.pack(side=tk.LEFT, pady=5)
        btn_delRemark = ttk.Button(frameBtnRemarks,
                                   text="Remove selected",
                                   command=self.deleteSelectedRemarkItem)
        btn_delRemark.pack(side=tk.LEFT, pady=5)
        frameBtnRemarks.pack(side=tk.TOP)

        # DEFECT TREEVW
        defectLabelFrame = ttk.LabelFrame(frameAllBelow, text="Defects table")
        self.paned = tk.PanedWindow(defectLabelFrame,
                                    orient=tk.VERTICAL,
                                    height=800)

        self.frameTw = ttk.Frame(self.paned)
        self.treevw = ttk.Treeview(self.frameTw,
                                   style='Report.Treeview',
                                   height=0)
        self.treevw['columns'] = ('ease', 'impact', 'risk', 'type', 'redactor')
        self.treevw.heading("#0", text='Title', anchor=tk.W)
        self.treevw.column("#0", anchor=tk.W, width=150)
        self.treevw.heading('ease', text='Ease')
        self.treevw.column('ease', anchor='center', width=40)
        self.treevw.heading('impact', text='Impact')
        self.treevw.column('impact', anchor='center', width=40)
        self.treevw.heading('risk', text='Risk')
        self.treevw.column('risk', anchor='center', width=40)
        self.treevw.heading('type', text='Type')
        self.treevw.column('type', anchor='center', width=10)
        self.treevw.heading('redactor', text='Redactor')
        self.treevw.column('redactor', anchor='center', width=20)
        self.treevw.tag_configure("Critical",
                                  background="black",
                                  foreground="white")
        self.treevw.tag_configure("Major",
                                  background="red",
                                  foreground="white")
        self.treevw.tag_configure("Important",
                                  background="orange",
                                  foreground="white")
        self.treevw.tag_configure("Minor",
                                  background="yellow",
                                  foreground="black")
        self.treevw.bind("<Double-Button-1>", self.OnDoubleClick)
        self.treevw.bind("<Delete>", self.deleteSelectedItem)
        self.treevw.bind("<Alt-Down>", self.bDown)
        self.treevw.bind("<Alt-Up>", self.bUp)
        self.treevw.bind("<ButtonPress-1>", self.dragStart)
        self.treevw.bind("<ButtonRelease-1>", self.dragRelease, add='+')
        self.treevw.bind("<B1-Motion>", self.dragMove, add='+')
        self.treevw.grid(row=0, column=0, sticky=tk.NSEW)
        scbVSel = ttk.Scrollbar(self.frameTw,
                                orient=tk.VERTICAL,
                                command=self.treevw.yview)
        self.treevw.configure(yscrollcommand=scbVSel.set)
        scbVSel.grid(row=0, column=1, sticky=tk.NS)
        self.frameTw.pack(side=tk.TOP, fill=tk.BOTH, padx=5, pady=10)
        self.frameTw.columnconfigure(0, weight=1)
        self.frameTw.rowconfigure(0, weight=1)
        ### OFFICE EXPORT FRAME ###
        belowFrame = ttk.Frame(self.paned)
        frameBtn = ttk.Frame(belowFrame)
        #lbl_help = FormHelper("DefectHelper", "Use del to delete a defect, use Alt+Arrows to order them")
        #lbl_help.constructView(frameBtn)
        self.buttonUpImage = ImageTk.PhotoImage(
            Image.open(getIconDir() + 'up-arrow.png'))
        self.buttonDownImage = ImageTk.PhotoImage(
            Image.open(getIconDir() + 'down-arrow.png'))
        # use self.buttonPhoto
        btn_down = ttk.Button(frameBtn,
                              image=self.buttonDownImage,
                              command=self.bDown)
        btn_down.pack(side="left", anchor="center")
        btn_up = ttk.Button(frameBtn,
                            image=self.buttonUpImage,
                            command=self.bUp)
        btn_up.pack(side="left", anchor="center")
        btn_delDefect = ttk.Button(frameBtn,
                                   text="Remove selection",
                                   command=self.deleteSelectedItem)
        btn_delDefect.pack(side=tk.RIGHT, padx=5)
        btn_addDefect = ttk.Button(frameBtn,
                                   text="Add a security defect",
                                   command=self.addDefectCallback)
        btn_addDefect.pack(side=tk.RIGHT, padx=5)

        btn_setMainRedactor = ttk.Button(frameBtn,
                                         text="Set main redactor",
                                         command=self.setMainRedactor)
        btn_setMainRedactor.pack(side=tk.RIGHT, padx=5)
        btn_browseDefects = ttk.Button(frameBtn,
                                       text="Browse defects templates",
                                       command=self.browseDefectsCallback)
        btn_browseDefects.pack(side=tk.RIGHT, padx=5)
        frameBtn.pack(side=tk.TOP, pady=5)
        officeFrame = ttk.LabelFrame(belowFrame, text=" Office reports ")
        ### INFORMATION EXPORT FRAME ###
        informations_frame = ttk.Frame(officeFrame)
        lbl_client = ttk.Label(informations_frame, text="Client's name :")
        lbl_client.grid(row=0, column=0, sticky=tk.E)
        self.ent_client = ttk.Entry(informations_frame, width=50)
        self.ent_client.grid(row=0, column=1, sticky=tk.W)
        lbl_contract = ttk.Label(informations_frame, text="Contract's name :")
        lbl_contract.grid(row=1, column=0, sticky=tk.E)
        self.ent_contract = ttk.Entry(informations_frame, width=50)
        self.ent_contract.grid(row=1, column=1, sticky=tk.W)

        lbl_lang = ttk.Label(informations_frame, text="Lang :")
        lbl_lang.grid(row=2, column=0, sticky=tk.E)
        self.combo_lang = ttk.Combobox(informations_frame,
                                       values=self.langs,
                                       width=10)
        self.combo_lang.grid(row=2, column=1, sticky=tk.W)
        self.combo_lang.bind("<<ComboboxSelected>>", self.langChange)
        informations_frame.pack(side=tk.TOP, pady=10)
        ### WORD EXPORT FRAME ###
        templatesFrame = ttk.Frame(officeFrame)
        templatesFrame.grid_columnconfigure(2, minsize=70)
        templatesFrame.grid_columnconfigure(3, minsize=300)
        lbl = ttk.Label(templatesFrame,
                        text="Word template",
                        background="white")
        lbl.grid(row=0, column=0, sticky=tk.E)
        self.combo_word = ttk.Combobox(templatesFrame,
                                       values=self.docx_models,
                                       width=50)
        self.combo_word.grid(row=0, column=1)
        btn_word_template_dl = ttk.Button(templatesFrame)
        self.btn_template_photo = tk.PhotoImage(
            file=os.path.join(getIconDir(), "download.png"))
        btn_word_template_dl.config(image=self.btn_template_photo,
                                    command=self.downloadWordTemplate)
        btn_word_template_dl.grid(row=0, column=2, sticky=tk.W)
        btn_word = ttk.Button(templatesFrame,
                              text="Generate Word report",
                              command=self.generateReportWord,
                              width=30)
        btn_word.grid(row=0, column=3, sticky=tk.E)
        ### POWERPOINT EXPORT FRAME ###
        lbl = ttk.Label(templatesFrame,
                        text="Powerpoint template",
                        background="white")
        lbl.grid(row=1, column=0, sticky=tk.E, pady=20)
        self.combo_pptx = ttk.Combobox(templatesFrame,
                                       values=self.pptx_models,
                                       width=50)
        self.combo_pptx.grid(row=1, column=1)
        btn_pptx_template_dl = ttk.Button(templatesFrame)
        btn_pptx_template_dl.config(image=self.btn_template_photo,
                                    command=self.downloadPptxTemplate)
        btn_pptx_template_dl.grid(row=1, column=2, sticky=tk.W)
        btn_ppt = ttk.Button(templatesFrame,
                             text="Generate Powerpoint report",
                             command=self.generateReportPowerpoint,
                             width=30)
        btn_ppt.grid(row=1, column=3, sticky=tk.E)
        templatesFrame.pack(side=tk.TOP, fill=tk.X, pady=10)
        officeFrame.pack(side=tk.TOP, fill=tk.BOTH, pady=10)
        belowFrame.pack(side=tk.TOP, fill=tk.BOTH)
        self.paned.add(self.frameTw)
        self.paned.add(belowFrame)
        self.paned.pack(fill=tk.BOTH, expand=1)
        defectLabelFrame.pack(side=tk.TOP, fill=tk.BOTH, pady=10)
        frameAllBelow.pack(side=tk.TOP, fill=tk.BOTH)
        self.paned_remarks.add(self.remarkframeTw)
        self.paned_remarks.add(frameAllBelow)
        self.paned_remarks.pack(fill=tk.BOTH, expand=1)
        self.remarksFrame.pack(side=tk.TOP, fill=tk.BOTH)
        self.reportFrame.pack(side=tk.TOP,
                              fill=tk.BOTH,
                              padx=10,
                              pady=10,
                              expand=1)
        self.fillWithDefects()
        self.fillWithRemarks()
예제 #22
0
    def __init__(self, parent, *args, **kwargs):
        tk.Frame.__init__(self, parent, *args, **kwargs)
        self.parent = parent

        top = tk.PanedWindow(root, bg=util.color_primary_dark)
        custom_font = tkFont.Font(size=10)

        # setup list
        list_label = tk.Label(top,
                              bg=util.color_primary_dark,
                              fg=util.color_white,
                              text="Selected files :")
        ctrl = Controller([],
                          tk.Listbox(
                              top,
                              borderwidth=0,
                              highlightbackground=util.color_accent_dark,
                              bg=util.color_accent_dark,
                              fg=util.color_white))
        tk.Listbox(top,
                   borderwidth=0,
                   highlightbackground=util.color_accent_dark,
                   bg=util.color_accent_dark,
                   fg=util.color_white)

        # input box
        password_label = tk.Label(top,
                                  bg=util.color_primary_dark,
                                  fg=util.color_white,
                                  text="Password :"******"Add", command=ctrl.add)
        filemenu1.add_command(
            label="Encrypt",
            command=lambda: ctrl.encrypt(password_input.get()))
        filemenu1.add_command(label="Decrypt", command=ctrl.decrypt)
        filemenu1.add_separator()
        filemenu1.add_command(label="Exit", command=root.quit)
        menubar.add_cascade(label="Options", menu=filemenu1)
        filemenu2 = tk.Menu(menubar, tearoff=0)
        filemenu2.add_command(label="Help")
        filemenu2.add_separator()
        filemenu2.add_command(label="About")
        menubar.add_cascade(label="Help", menu=filemenu2)

        # encryption and decryption button
        encrypt_btn = tk.Button(
            top,
            text="Encrypt",
            command=lambda: ctrl.encrypt(password_input.get()),
            bg=util.color_accent_dark,
            fg=util.color_white,
            borderwidth=0,
            font=custom_font)
        decrypt_btn = tk.Button(
            top,
            text="Decrypt",
            command=lambda: ctrl.decrypt(password_input.get()),
            bg=util.color_accent_dark,
            fg=util.color_white,
            borderwidth=0,
            font=custom_font)

        # file add and remove button
        add_btn = tk.Button(top,
                            text="Add",
                            command=ctrl.add,
                            bg=util.color_primary,
                            fg=util.color_white,
                            borderwidth=0)
        remove_btn = tk.Button(top,
                               text="Remove",
                               command=ctrl.remove,
                               bg=util.color_danger,
                               fg=util.color_white,
                               borderwidth=0)

        # element placement
        add_btn.place(height=30, width=60, x=350, y=260)  # file add btn
        remove_btn.place(height=30, width=70, x=420, y=260)  # file remove btn
        encrypt_btn.place(height=40, width=100, x=10,
                          y=10)  # start encryption btn
        decrypt_btn.place(height=40, width=100, x=10,
                          y=60)  # start decryption btn
        list_label.place(height=20, x=120, y=10)  # file list label
        ctrl.listbox.place(height=175, width=370, x=120, y=35)  # file list
        password_label.place(height=20, width=60, x=120,
                             y=230)  # password input label
        password_input.place(height=20, width=300, x=190,
                             y=230)  # password input
        top.place(height=300, width=500, x=0, y=0)  # parent element
        root.config(menu=menubar)  # setup menu
예제 #23
0
                                 (screenWidth - windowWidth) / 2,
                                 (screenHeight - windowHeight) / 2)
root.geometry(geometryParam)  #设置窗口大小及偏移坐标
root.wm_attributes('-topmost', 1)  #窗口置顶

# 1创建主菜单
bigmenu = tkinter.Menu(root)
file_menu = tkinter.Menu(bigmenu)  # 创建空菜单
file_menu.add_command(label="打开目录", command=open_dir)
file_menu.add_command(label="退出", command=close_window)
bigmenu.add_cascade(label="文件", menu=file_menu)  # 将file_menu菜单添加到菜单栏
# 4将主餐单加入窗口
root.config(menu=bigmenu)

# 创建组件          垂直摆放:vertical   水平摆放:horizontal
panedwindow = tkinter.PanedWindow(root, orient='horizontal')
# 添加组件
label_img = tkinter.Label(panedwindow,
                          width=50,
                          height=50,
                          compound='center',
                          text="    ")
label_img.pack()

# 创建组件

labelframe = tkinter.LabelFrame(panedwindow, text='场景选择')
labelframe.pack()

with open("label.ini", "r", encoding="utf-8") as f:
    lines = f.readlines()
예제 #24
0
def open_report():
    global file_path, reports_num
    reports_num += 1
    file_path['Report%i' % (reports_num)] = filedialog.askopenfilename(
        initialdir="/",
        title="Select file",
        filetypes=(("txt files", "*.txt"), ("all files", "*.*")))
    if file_path['Report%i' % (reports_num)] == '':
        reports_num -= 1
    else:
        file = open(file_path['Report%i' % (reports_num)], 'r+')

        file_read = file.read()
        report_names = re.findall(
            r'Startpoint\: ([a-z].*)(?:.*\n)*?.*Endpoint\: ([a-z].*)(?:.*\n)*?.*Path Group\: ([a-zA-Z0-9].*)(?:.*\n)*?.*slack \([A-Z]*\).*?(-?[0-9].*)',
            file_read)
        startpoint_list = []
        endpoint_list = []
        pathgroup_list = []
        timingslack_list = []
        all_list = []
        for item in report_names:
            if startpoint_list.count(item[0].split('(')[0].replace(' ',
                                                                   '')) == 0:
                startpoint_list.append(item[0].split('(')[0].replace(' ', ''))
        for item in report_names:
            if endpoint_list.count(item[1].split('(')[0].replace(' ',
                                                                 '')) == 0:
                endpoint_list.append(item[1].split('(')[0].replace(' ', ''))
        for item in report_names:
            if pathgroup_list.count(item[2]) == 0:
                pathgroup_list.append(item[2])
        for item in report_names:
            if timingslack_list.count(item[3]) == 0:
                timingslack_list.append(item[3])
        for item in startpoint_list:
            if all_list.count(item) == 0:
                all_list.append(item)
        for item in endpoint_list:
            if all_list.count(item) == 0:
                all_list.append(item)
        for item in pathgroup_list:
            if all_list.count(item) == 0:
                all_list.append(item)
        for item in timingslack_list:
            if all_list.count(item) == 0:
                all_list.append(item)

        report_details = re.findall(
            r'(.*Startpoint\: [a-z].*(?:.*\n)*?.*Endpoint\: [a-z].*(?:.*\n)*?.*Path Group\: [a-zA-Z0-9].*(?:.*\n)*?.*slack \([A-Z]*\).*?[[0-9].*)',
            file_read)

        report_names_list = []
        for item in report_names:
            report_names_list.append(list(item))

        for item in report_names_list:
            item[0] = item[0].split('(')[0].replace(' ', '')
            item[1] = item[1].split('(')[0].replace(' ', '')
        df = pd.DataFrame(
            report_names_list,
            columns=['Startpoint', 'Endpoint', 'Path Group', 'Timing Slack'])

        window = tk.Toplevel(root)
        # window = globals()['window'+str(reports_num)]
        window.geometry('800x700')
        window.minsize(800, 600)
        window.title('DC Analysis')

        pw = tk.PanedWindow(window)
        pw.pack(expand=1, fill='both')
        globals()['window' + str(reports_num) + '_search'] = Search_section(
            pw, reports_num, startpoint_list, endpoint_list, pathgroup_list,
            timingslack_list, all_list)
        ss = globals()['window' + str(reports_num) + '_search']
        pw.add(ss.mainframe, sticky='nesw', minsize=215, padx=2)
        right_frame = tk.Frame(pw)
        globals()['window' + str(reports_num) + '_tb'] = Build_report_names(
            right_frame, df, report_details, reports_num)
        tb = globals()['window' + str(reports_num) + '_tb']
        pw.add(right_frame, sticky='nesw')
예제 #25
0
파일: 1.03.py 프로젝트: joyfish/Programas
my_canvas.pack()
my_canvas.create_oval(20, 15, 60, 60, fill='red')
my_canvas.create_oval(40, 15, 60, 60, fill='grey')
my_canvas.create_text(130,
                      38,
                      text='I am a tk.Canvas Widget',
                      font=('arial', 8, 'bold'))

#
#
# A paned window widget
#
#

tk.Label(root, text='Below is an example of Paned window widget:').pack()
tk.Label(
    root,
    text='Notice you can adjust the size of each pane by dragging it').pack()
my_paned_window_1 = tk.PanedWindow()
my_paned_window_1.pack(fill=tk.BOTH, expand=2)
left_pane_text = tk.Text(my_paned_window_1, height=6, width=15)
my_paned_window_1.add(left_pane_text)
my_paned_window_2 = tk.PanedWindow(my_paned_window_1, orient=tk.VERTICAL)
my_paned_window_1.add(my_paned_window_2)
top_pane_text = tk.Text(my_paned_window_2, height=3, width=3)
my_paned_window_2.add(top_pane_text)
bottom_pane_text = tk.Text(my_paned_window_2, height=3, width=3)
my_paned_window_2.add(bottom_pane_text)

root.mainloop()
예제 #26
0
import tkinter

window = tkinter.Tk()
window.title("20 PanedWindow")
window.geometry("640x400+100+100")
window.resizable(True, True)

panedwindow1 = tkinter.PanedWindow(relief="raised", bd=2)
panedwindow1.pack(expand=True)

left = tkinter.Label(panedwindow1, text="내부윈도우-1 (좌측)")
panedwindow1.add(left)

panedwindow2 = tkinter.PanedWindow(panedwindow1,
                                   orient="vertical",
                                   relief="groove",
                                   bd=3)
panedwindow1.add(panedwindow2)

right = tkinter.Label(panedwindow1, text="내부윈도우-2 (우측)")
panedwindow1.add(right)

top = tkinter.Label(panedwindow2, text="내부윈도우-3 (상단)")
panedwindow2.add(top)

bottom = tkinter.Label(panedwindow2, text="내부윈도우-4 (하단)")
panedwindow2.add(bottom)

window.mainloop()
예제 #27
0
    def create_widgets(self, score, w, h):  # ウィジェット作成

        self.create_menu_bar()

        self.w = w
        self.h = h
        self.pw = tkinter.PanedWindow(self, orient='horizontal')  # 全画面
        self.pw.pack(expand=True)

        self.pwLeft = tkinter.PanedWindow(self.pw, orient='vertical')  # 左画面
        self.pw.add(self.pwLeft)

        self.pwRight = tkinter.PanedWindow(self.pw, orient='vertical')  # 右画面
        self.pw.add(self.pwRight)

        self.pwLeftUp = tkinter.PanedWindow(self.pwLeft, orient='horizontal') # 左画面の上側
        self.pwLeft.add(self.pwLeftUp)

        self.pwRightUp = tkinter.PanedWindow(self.pwRight, orient='horizontal') # 右画面の上側
        self.pwRight.add(self.pwRightUp)

        self.create_image()  # 左画面の上側 画像描画部分
        self.create_scale()  # 左画面の上側 スケール

        self.canvas1 = tkinter.Canvas(self.pwRightUp, width = 195, height = 380)#テニスコート用のcanvas作成
        self.createCourt(self.canvas1,self.courtsize,self.pwRightUp)#テニスコート

        self.canvas2 = tkinter.Canvas(self.pwRightUp, width = 195, height = 380)#テニスコート用のcanvas作成
        self.createCourt(self.canvas2,self.courtsize,self.pwRightUp)#テニスコート


        self.pwLeftDown = tkinter.PanedWindow(self.pwLeft, orient='horizontal') # 左画面の下側
        self.pwLeft.add(self.pwLeftDown)

        self.pwRightDown = tkinter.PanedWindow(self.pwRight, orient='horizontal') # 右画面の下側
        self.pwRight.add(self.pwRightDown)


        self.pwLeftLeft = tkinter.PanedWindow(self.pwLeftDown, orient='vertical') # 左画面の下側 左
        self.pwLeftDown.add(self.pwLeftLeft)

        self.pwLeftRight = tkinter.PanedWindow(self.pwLeftDown, orient='vertical') # 左画面の下側 右
        self.pwLeftDown.add(self.pwLeftRight)

        self.pw1_1 = tkinter.PanedWindow(self.pwLeft, orient='horizontal') # コマ送り
        self.pwLeftLeft.add(self.pw1_1)
        self.create_button(self.pw1_1)

        self.pw1_2 = tkinter.PanedWindow(self.pwLeft, orient='horizontal') # 動画再生UI
        self.pwLeftLeft.add(self.pw1_2)
        self.create_button2(self.pw1_2)

        self.pw1_3 = tkinter.PanedWindow(self.pwLeftLeft, orient='horizontal') # 左画面の下側 左
        self.pwLeftLeft.add(self.pw1_3)
        self.create_button3()

        self.pw1_4 = tkinter.PanedWindow(self.pwLeftLeft, orient='horizontal') # 左画面の下側 左 ポイント種別
        self.pwLeftLeft.add(self.pw1_4)
        self.create_button4(self.pw1_4)


        self.create_tree()#タグ一覧を右に描画
        self.setTree()
        self.tree.bind('<ButtonRelease-1>', self.select)  # Double-1
        self.tree.selection_set(self.tree.get_children()[0])

        self.change_state()
예제 #28
0
    try:
        files = get_old_puzzles()
        for file in files:
            if file[0] == filename:
                os.system('python src/main.py data/' + file[1])

    except Exception as e:
        print(e)
        sys.exit()


root = tk.Tk()
root.title('Welcome')

# lEFT
left_pane = tk.PanedWindow()
left_pane.pack(side=tk.LEFT, padx=(10, 10), pady=(20, 20))

# Label
tk.Label(left_pane, text="Click to get Today's puzzle").pack()

# Button for Today's puzzle
tk.Button(left_pane,
          text="Today's puzzle",
          command=display_todays_puzzle,
          relief=tk.RAISED).pack()

# ----------------

# RIGHT
right_pane = tk.PanedWindow()
예제 #29
0
    def __init__(self, parent, items=(), headers=(), add_sizegrip=False):
        """Initialise a CheckDetails pane.

        parent is the parent widget.
        items is a list of Items objects.
        headers is a list of the header strings.
        If add_sizegrip is True, add a sizegrip object between the scrollbars.
        """
        super(CheckDetails, self).__init__(parent)

        self.parent = parent
        self.headers = list(headers)
        self.items = []  # type: List[Item]
        self.sort_ind = None
        self.rev_sort = False  # Should we sort in reverse?

        self.head_check_var = tk.IntVar(value=False)
        self.wid_head_check = ttk.Checkbutton(
            self,
            variable=self.head_check_var,
            command=self.toggle_allcheck,
            takefocus=False,
            width=0,
        )
        self.wid_head_check.grid(row=0, column=0)

        add_tooltip(self.wid_head_check, _("Toggle all checkboxes."))

        def checkbox_enter(e):
            """When hovering over the 'all' checkbox, highlight the others."""
            for item in self.items:
                item.check.state(['active'])

        self.wid_head_check.bind('<Enter>', checkbox_enter)

        def checkbox_leave(e):
            for item in self.items:
                item.check.state(['!active'])

        self.wid_head_check.bind('<Leave>', checkbox_leave)

        self.wid_header = tk.PanedWindow(
            self,
            orient=tk.HORIZONTAL,
            sashrelief=tk.RAISED,
            sashpad=2,
            showhandle=False,
        )
        self.wid_header.grid(row=0, column=1, sticky='EW')
        self.wid_head_frames = [0] * len(self.headers)  # type: List[ttk.Frame]
        self.wid_head_label = [0] * len(self.headers)  # type: List[ttk.Label]
        self.wid_head_sort = [0] * len(self.headers)  # type: List[ttk.Label]
        self.make_headers()

        self.wid_canvas = tk.Canvas(self, )
        self.wid_canvas.grid(row=1, column=0, columnspan=2, sticky='NSEW')
        self.columnconfigure(1, weight=1)
        self.rowconfigure(1, weight=1)

        self.horiz_scroll = ttk.Scrollbar(
            self,
            orient=tk.HORIZONTAL,
            command=self.wid_canvas.xview,
        )
        self.vert_scroll = ttk.Scrollbar(
            self,
            orient=tk.VERTICAL,
            command=self.wid_canvas.yview,
        )
        self.wid_canvas['xscrollcommand'] = self.horiz_scroll.set
        self.wid_canvas['yscrollcommand'] = self.vert_scroll.set

        self.horiz_scroll.grid(row=2, column=0, columnspan=2, sticky='EWS')
        self.vert_scroll.grid(row=1, column=2, sticky='NSE')
        if add_sizegrip and utils.USE_SIZEGRIP:
            self.sizegrip = ttk.Sizegrip(self)
            self.sizegrip.grid(row=2, column=2)
        else:
            self.sizegrip = None

        self.wid_frame = tk.Frame(self.wid_canvas,
                                  background='white',
                                  border=0)
        self.wid_canvas.create_window(0, 0, window=self.wid_frame, anchor='nw')

        self.bind('<Configure>', self.refresh)
        self.bind('<Map>', self.refresh)  # When added to a window, refresh

        self.wid_header.bind('<ButtonRelease-1>', self.refresh)
        self.wid_header.bind('<B1-Motion>', self.refresh)
        self.wid_header.bind('<Configure>', self.refresh)

        self.add_items(*items)

        utils.add_mousewheel(
            self.wid_canvas,
            self.wid_canvas,
            self.wid_frame,
            self.wid_header,
        )
예제 #30
0
    def __init__(self, master, path_):
        # tkinter root
        self.master = master

        # window parameters
        self.master.title("Módulo para Detección de Órdenes Anómalas - COPROLAC")
        self.master.configure(background=bg_color)

        # New window default parameter
        self.new_win = None

        # Anomaly App instance declaration
        self.app = AnomalyApp(path_)

        # screen width and height, and toplevel width and height
        self.screen_width = GetSystemMetrics(0)
        self.screen_height = GetSystemMetrics(1)
        self.width = self.screen_width / 2
        self.height = self.screen_height / 2

        # Paned Window that contains the tree view and a master frame
        self.main_paned = tk.PanedWindow(self.master,
                                         orient=tk.HORIZONTAL)
        self.main_paned.pack(fill=tk.BOTH, expand=1)

        # Listbox - Shows status of the program and relevant information for the user.
        self.list_box = tk.Listbox(self.master,
                                   bg=bg_color,
                                   width=150,
                                   height=20)
        self.main_paned.add(self.list_box)

        # Frame - Contains Load, Execute and Export buttons
        self.config_frame = tk.Frame(self.master,
                                     bg=bg_color)
        self.main_paned.add(self.config_frame)

        # Button - Load files
        self.btn_load_files = tk.Button(self.config_frame,
                                        bg=bg_color,
                                        text='Cargar archivos',
                                        command=self.open_window_select_path)
        self.btn_load_files.pack(padx=5,
                                 pady=10)

        # Button - Search
        self.btn_search = tk.Button(self.config_frame,
                                    bg=bg_color,
                                    text='Buscar anomalías',
                                    command=self.run_anomaly_check)
        self.btn_search.pack(padx=5,
                             pady=10)

        # Button - Config
        self.btn_config = tk.Button(self.config_frame,
                                    bg=bg_color,
                                    text='Configuración',
                                    command=self.open_window_config)
        self.btn_config.pack(padx=5,
                             pady=10)

        # Button - Export result
        self.btn_export = tk.Button(self.config_frame,
                                    bg=bg_color,
                                    text='Exportar resultado',
                                    state='disabled',
                                    command=self.run_export)
        self.btn_export.pack(padx=5,
                             pady=10)

        center_window(self.master, self.screen_width, self.screen_height)