Esempio n. 1
0
    def make_widgets(self):
        self.entry = Entry(self, textvariable=self.var)
        self.arrow = LabelHilited(self, text='\u25BC', width=2)
        # self.arrow = ComboboxArrow(self, text='\u25BC', width=2)

        self.entry.grid(column=0, row=0)
        self.arrow.grid(column=1, row=0)

        self.update_idletasks()
        self.width = self.winfo_reqwidth()

        self.drop = ToplevelHilited(self, bd=0)
        self.drop.bind('<Destroy>', self.clear_reference_to_dropdown)
        self.drop.withdraw()
        Combobox.hive.append(self.drop)
        for widg in (self.master, self.drop):
            widg.bind('<Escape>', self.hide_all_drops, add='+')

        self.drop.grid_columnconfigure(0, weight=1)
        self.drop.grid_rowconfigure(0, weight=1)

        self.canvas = CanvasHilited(self.drop)
        self.canvas.grid(column=0, row=0, sticky='news')

        self.scrollv_combo = Scrollbar(self.drop,
                                       hideable=True,
                                       command=self.canvas.yview)
        self.canvas.config(yscrollcommand=self.scrollv_combo.set)
        self.content = Frame(self.canvas)

        self.content.grid_columnconfigure(0, weight=1)
        self.content.grid_rowconfigure('all', weight=1)

        self.scrollv_combo.grid(column=1, row=0, sticky='ns')

        self.entry.bind('<KeyPress>', self.open_or_close_dropdown)
        self.entry.bind('<Tab>', self.open_or_close_dropdown)

        for widg in (self.entry, self.arrow):
            widg.bind('<Button-1>', self.open_or_close_dropdown, add='+')

        self.arrow.bind('<Button-1>', self.focus_entry_on_arrow_click, add='+')

        for frm in (self, self.content):
            frm.bind('<FocusIn>', self.arrow.highlight)
            frm.bind('<FocusOut>', self.arrow.unhighlight)

        self.drop.bind('<FocusIn>', self.focus_dropdown)
        self.drop.bind('<Unmap>', self.unhighlight_all_drop_items)

        self.current_combo_parts = [
            self, self.entry, self.arrow, self.scrollv_combo
        ]
        for part in self.current_combo_parts:
            part.bind('<Enter>', self.unbind_combo_parts)
            part.bind('<Leave>', self.rebind_combo_parts)

        self.config_values(self.values)

        config_generic(self.drop)
Esempio n. 2
0
    def __init__(self,
                 parent,
                 gparent=None,
                 prompt=None,
                 message=None,
                 input_text=None,
                 *args,
                 **kwargs):
        MessageModel.__init__(self, parent, *args, **kwargs)

        self.gparent = gparent

        self.promptlab.grid()
        self.altentry.grid()

        self.promptlab.config(text=prompt)

        self.errshow.config(text=input_text)
        self.input_text = input_text

        self.errmsg.config(text=message)

        self.accept.grid()
        self.edit.grid()
        self.cancel_all.grid()

        config_generic(self)
 def context_help(self):
     help = Toplevel()
     help.title(self.help_title)
     text = LabelStylable(help, width=75)
     text.grid(padx=24, pady=24)
     text.insert('end', self.message)
     off = Button(help, text='Done', command=help.destroy)
     off.grid(padx=24, pady=24, sticky='e')
     config_generic(help)
     off.focus_set()
Esempio n. 4
0
def main():

    root = tk.Tk()

    root.geometry('+100+50')
    root.overrideredirect(1)
    root.iconbitmap(default='{}favicon.ico'.format(project_path))
    Treebard(root)

    config_generic(root)

    root.mainloop()
Esempio n. 5
0
    def __init__(self, parent, message=None, show_input=None, *args, **kwargs):
        MessageModel.__init__(self, parent, *args, **kwargs)

        self.show_input = show_input

        self.errshow.config(text=self.show_input)

        self.errmsg.config(text=message)
        self.done.config(text='SUBMIT')
        self.done.grid()
        self.stop.grid()

        config_generic(self)
Esempio n. 6
0
    def make_widgets(self):

        self.entry = Entry(self, textvariable=self.var)
        self.arrow = LabelHilited(self, text='\u25BC', width=2)

        self.entry.grid(column=0, row=0)
        self.arrow.grid(column=1, row=0, padx=0, pady=0)

        self.next_on_tab = self.tk_focusNext()
        self.prev_on_tab = self.tk_focusPrev()

        self.update_idletasks()
        self.width = self.winfo_reqwidth()

        self.drop = ToplevelHilited(
            self,
            bd=0)
        self.drop.withdraw()
        Combobox.hive.append(self.drop)
        self.master.bind('<Escape>', self.hide_all_drops)

        self.drop.grid_columnconfigure(0, weight=1)
        self.drop.grid_rowconfigure(0, weight=1)

        self.canvas = CanvasScrolledBG2(
            self.drop,
            fixed_width=True,
            scrollregion_width=self.width,
            scrollbar='vert')
        self.canvas.grid(column=0, row=0, sticky='news')

        self.canvas.content.grid_columnconfigure(0, weight=1)
        self.canvas.content.grid_rowconfigure('all', weight=1)

        self.canvas.vert.grid(column=1, row=0, sticky='ns') 

        self.entry.bind('<KeyPress>', self.open_or_close_dropdown)

        for widg in (self.entry, self.arrow):
            widg.bind('<Button-1>', self.open_or_close_dropdown)
    
        self.arrow.bind('<Button-1>', self.focus_entry_on_arrow_click, add='+')        

        for frm in (self, self.canvas.content):
            frm.bind('<FocusIn>', self.highlight_arrow)
            frm.bind('<FocusOut>', self.unhighlight_arrow)

        self.drop.bind('<FocusIn>', self.focus_dropdown)

        self.config_values(self.values)
        config_generic(self.drop)
Esempio n. 7
0
    def make_widgets(self):
        '''
            The entry and arrow need to trigger the same events, but binding
            them to the same events would be a can of worms because of the
            Enter and Leave events. Instead, the binding is to self--the frame 
            that both the entry and the arrow are in--and the underlying frame
            sees the events and responds.
        '''

        self.entry = Entry(self)
        self.arrow = LabelHilited(self, text='\u25EF', width=2)
        self.arrow.bind('<Button-1>', self.focus_entry_on_arrow_click)

        self.entry.grid(column=0, row=0)
        self.arrow.grid(column=1, row=0, padx=0, pady=0)

        self.update_idletasks()
        self.width = self.winfo_reqwidth()

        self.drop = ToplevelHilited(self, bd=0)
        self.drop.withdraw()
        self.drop.bind('<Unmap>', self.focus_entry_on_unmap)
        Bilbobox.hive.append(self.drop)
        self.master.bind('<Escape>', self.hide_all_drops)

        self.drop.grid_columnconfigure(0, weight=1)
        self.drop.grid_rowconfigure(0, weight=1)

        self.canvas = CanvasScrolledBG2(self.drop,
                                        fixed_width=True,
                                        scrollregion_width=self.width,
                                        scrollbar='vert')
        self.canvas.grid(column=0, row=0, sticky='news')

        self.canvas.content.grid_columnconfigure(0, weight=1)
        self.canvas.content.grid_rowconfigure('all', weight=1)

        self.canvas.vert.grid(column=1, row=0, sticky='ns')

        self.bind('<Enter>', self.open_dropdown)

        for widg in (self, self.canvas.vert, self.canvas.content):
            widg.bind('<Leave>', self.hide_this_drop)
            widg.bind('<Enter>', self.detect_enter, add='+')

        for frm in (self, self.canvas.content):
            frm.bind('<FocusIn>', self.highlight_arrow)
            frm.bind('<FocusOut>', self.unhighlight_arrow)

        self.config_values(self.values)
        config_generic(self.drop)
Esempio n. 8
0
    def __init__(self, parent, message=None, input_text=None, *args, **kwargs):
        MessageModel.__init__(self, parent, *args, **kwargs)

        if input_text:
            self.errshow.config(text=input_text)
        else:
            self.errlab.grid_forget()

        self.errmsg.config(text=message)

        self.done.grid()

        self.done.config(command=self.cancel)

        config_generic(self)
Esempio n. 9
0
    def apply(self):
        def resize_scrollbar():
            self.root.update_idletasks()
            self.canvas_docs.config(scrollregion=self.canvas_docs.bbox('all'))

        self.font_scheme[0] = self.fontSizeVar.get()
        if len(self.combos["select_output_font"].get()) != 0:
            self.font_scheme[1] = self.combos["select_output_font"].get()
        if len(self.combos["select_input_font"].get()) != 0:
            self.font_scheme[2] = self.combos["select_input_font"].get()
        conn = sqlite3.connect(current_file)
        conn.execute('PRAGMA foreign_keys = 1')
        cur = conn.cursor()
        cur.execute(update_format_fonts, tuple(self.font_scheme))
        conn.commit()
        cur.close()
        conn.close()

        config_generic(self.root)

        resize_scrollbar()
    def make_widgets(self):

        self.grid(column=0, row=1, sticky='news')

        self.border_top = FrameTitleBar(self.master, height=3, name='top')
        self.title_bar = FrameTitleBar(self.master)

        self.menu = Frame(self.master)
        self.ribbon = Frame(self.master)

        self.border_left = FrameTitleBar(self.master, width=3, name='left')
        self.border_right = FrameTitleBar(self.master, width=3, name='right')

        self.statusbar = StatusbarTooltips(self.master)

        self.border_bottom = FrameTitleBar(self.master,
                                           height=3,
                                           name='bottom')
        self.master.grid_columnconfigure(1, weight=1)
        self.master.grid_rowconfigure(4, weight=1)

        self.border_top.config(cursor='sb_v_double_arrow')
        self.border_left.config(cursor='sb_h_double_arrow')
        self.border_right.config(cursor='sb_h_double_arrow')
        self.border_bottom.config(cursor='sb_v_double_arrow')

        self.border_top.grid(column=0, row=0, columnspan=4, sticky='ew')
        self.title_bar.grid(column=1, row=1, columnspan=2, sticky='ew')
        if self.menubar is True:
            self.menu.grid(column=1, row=2, columnspan=2, sticky='ew')
        if self.ribbon_menu is True:
            self.ribbon.grid(column=1, row=3, columnspan=2, sticky='ew')
        self.grid(column=1, row=4, sticky='news')
        self.border_left.grid(column=0, row=1, rowspan=6, sticky='ns')
        self.border_right.grid(column=3, row=1, rowspan=6, sticky='ns')
        self.statusbar.grid(column=1, row=6, columnspan=2, sticky='ew')
        self.border_bottom.grid(column=0, row=7, columnspan=4, sticky='ew')

        self.config(cursor='arrow')

        # children of self.title_bar
        self.title_bar.grid_columnconfigure(0, weight=1)
        self.title_bar.grid_columnconfigure(1, weight=0)
        self.title_frame = FrameTitleBar(self.title_bar)
        self.buttonbox = FrameTitleBar(self.title_bar)

        self.title_frame.pack(side='left')
        self.buttonbox.place(relx=1.0, x=-100, rely=0.125, y=-2)

        # children of self.title_frame
        self.logo = TitleBarButtonSolidBG(self.title_frame,
                                          icon='logo',
                                          icon_size=self.icon_size)

        self.txt_frm = FrameTitleBar(self.title_frame)
        self.logo.pack(side='left', pady=(0, 3), padx=(0, 12))
        self.txt_frm.pack(side='left')

        # children of text_frm
        self.title_1 = LabelTitleBar(self.txt_frm,
                                     size=self.icon_size,
                                     text='Toykinter Demo')
        self.title_1b = FrameTitleBar(self.txt_frm, width=36)
        self.title_2 = LabelTitleBar(self.txt_frm,
                                     size=self.icon_size,
                                     text='for all ages')

        self.title_1.grid(column=0, row=0)
        self.title_1b.grid(column=1, row=0, sticky='ew')
        self.title_2.grid(column=2, row=0)

        # children of self.buttonbox
        self.minn = TitleBarButton(self.buttonbox,
                                   icon='min',
                                   icon_size=self.icon_size)
        self.maxx = TitleBarButton(self.buttonbox,
                                   icon='max',
                                   icon_size=self.icon_size)
        self.restore = TitleBarButton(self.buttonbox,
                                      icon='restore',
                                      icon_size=self.icon_size)
        self.quitt = TitleBarButton(self.buttonbox,
                                    icon='quit',
                                    icon_size=self.icon_size)

        self.minn.grid(column=0, row=0, sticky='w')
        self.maxx.grid(column=1, row=0, sticky='w', padx=(0, 3))
        self.restore.grid(column=1, row=0, sticky='w', padx=(0, 3))
        self.restore.grid_remove()
        self.quitt.grid(column=2, row=0, sticky='e', padx=(0, self.size))

        self.master.update_idletasks()
        to_the_left = self.buttonbox.winfo_reqwidth()
        self.buttonbox.place(relx=1.0,
                             x=-to_the_left,
                             rely=0.125,
                             y=-2 * self.rel_y)

        # bindings
        self.master.bind('<Map>', self.hide_windows_titlebar)
        self.minn.bind('<Button-1>', self.minimize)
        self.maxx.bind('<Button-1>', self.toggle_max_restore)
        self.restore.bind('<Button-1>', self.toggle_max_restore)
        self.quitt.bind('<Button-1>', close)
        x = [
            i.bind('<Map>', self.recolorize_on_restore)
            for i in (self.minn, self.quitt)
        ]

        for widg in (self.title_bar, self.title_frame, self.logo, self.title_1,
                     self.title_1b, self.title_2, self.txt_frm,
                     self.buttonbox):
            widg.bind('<B1-Motion>', self.move_window)
            widg.bind('<Button-1>', self.get_pos)
            widg.bind('<Double-Button-1>', self.toggle_max_restore)

        for widg in (self.border_top, self.border_left, self.border_right,
                     self.border_bottom):
            widg.bind('<Button-1>', self.start_edge_sizer)
            widg.bind('<B1-Motion>', self.stop_edge_sizer)
            widg.bind('<ButtonRelease-1>', self.stop_edge_sizer)

        config_generic(self.master)
Esempio n. 11
0
        conn.execute('PRAGMA foreign_keys = 1')
        cur = conn.cursor()
        cur.execute(update_format_fonts, tuple(self.font_scheme))
        conn.commit()
        cur.close()
        conn.close()

        config_generic(self.root)

        resize_scrollbar()

    def show_font_size(self, evt):
        self.fontSize = self.fontSizeVar.get()


if __name__ == "__main__":

    root = tk.Tk()

    t = FontPicker(root, root)
    t.grid()

    q = Label(
        root,
        text="This text represents everything outside of the "
        "font picker.\n It doesn't change until you click the APPLY button.")
    q.grid(padx=24, pady=48)

    config_generic(root)

    root.mainloop()
Esempio n. 12
0
    def make_widgets(self):

        self.title('{}{} ({})'.format('Notes for Conclusion #',
                                      self.finding_id, self.birth_name))

        self.grid_columnconfigure(0, weight=1)
        self.grid_rowconfigure(1, weight=1)
        header = Frame(self)
        header.grid_columnconfigure(1, weight=1)
        header.grid_rowconfigure(0, weight=1)

        self.notes_dialog_header = Frame(header)

        content = Frame(self)

        left_panel = Frame(content)

        topiclab = Label(left_panel, text='Note Subtopics')

        self.toc = Listbox(left_panel,
                           self.sorted_subtopics,
                           view_height=424,
                           view_width=180,
                           scrollbar=False)

        self.new_index = len(self.subtopics)
        self.toc.insert(self.new_index, self.new_subtopic_label_text)
        self.toc.focus_set()
        self.toc.selection_set(0)

        self.toc.store_new_subtopic_name = self.store_new_subtopic_name
        self.toc.pass_ctrl_click = self.open_links_dialog
        self.toc.pass_delete_key = self.delete_note

        self.selected_subtopic = Label(content, text='New Note')

        self.note_input = ScrolledText(content)

        note_submit = Button(content,
                             text='Submit Changes',
                             command=self.save_changes)

        order = Button(content,
                       text='Change Order of Subtopics',
                       command=self.reorder_notes)

        radframe = LabelFrame(content, text='Make selected note...')

        self.public = Radiobutton(radframe,
                                  text='...public',
                                  anchor='w',
                                  variable=self.privacy,
                                  value=0,
                                  command=self.save_privacy_setting)

        self.private = Radiobutton(radframe,
                                   text='...private',
                                   anchor='w',
                                   variable=self.privacy,
                                   value=1,
                                   command=self.save_privacy_setting)

        close = Button(content, text='DONE', command=self.close_roles_dialog)

        # notes_statusbar = StatusbarTooltips(self)

        # visited = (
        # (above,
        # 'this is a notes_statusbar message',
        # 'this is a tooltip'),
        # (below,
        # 'this is also a notes_statusbar message',
        # 'this is another tooltip'))

        # run_statusbar_tooltips(
        # visited,
        # notes_statusbar.status_label,
        # notes_statusbar.tooltip_label)

        # grid in self
        header.grid(column=0, row=0, columnspan=2, pady=12, sticky='we')
        content.grid(column=0, row=1, sticky='news', padx=(0, 6))
        # notes_statusbar.grid(column=0, row=2, sticky='ew')

        # grid in header
        self.notes_dialog_header.grid(column=1, row=0, sticky='ew')
        self.notes_dialog_header.grid_columnconfigure(0, weight=1)

        # grid in content
        left_panel.grid(column=0, row=1, sticky='news', rowspan=2, pady=24)
        self.selected_subtopic.grid(column=1, row=1, sticky='w')
        self.note_input.grid(column=1,
                             row=2,
                             columnspan=3,
                             sticky='nsew',
                             padx=(0, 24),
                             pady=12)
        note_submit.grid(column=3, row=3, sticky='se')
        self.grid_rowconfigure(0, weight=1)
        self.grid_columnconfigure(0, weight=1)
        content.grid_rowconfigure(1, weight=1)
        order.grid(column=1, row=4)
        radframe.grid(column=2, row=5, sticky='n', pady=24)
        close.grid(column=3, row=6, sticky='se', padx=24, pady=(0, 24))

        # grid in left_panel
        topiclab.grid(column=0, row=0)
        self.toc.grid(column=0, row=1)
        for child in self.toc.listbox_content.winfo_children():
            child.bind('<<ListboxSelected>>', self.switch_note)

        self.subtopic_widgets = self.toc.listbox_content.winfo_children()

        # grid in radframe
        self.public.grid(column=0, row=0, sticky='news', padx=24)
        self.private.grid(column=0, row=1, sticky='news', padx=24)

        # rcm_widgets = (self.subtopic_input, self.note_input.text)
        # make_rc_menus(
        # rcm_widgets,
        # self.rc_menu,
        # note_dlg_msg,
        # header_parent=self.notes_dialog_header,
        # header=self.header,
        # which_dlg='notes')

        config_generic(self)
        center_window(self)
Esempio n. 13
0
    def make_chart(self):
        def scroll_start(event):
            self.scan_mark(event.x, event.y)

        def scroll_move(event):
            self.scan_dragto(event.x, event.y, gain=3)

        xsb = tk.Scrollbar(self.master,
                           orient="horizontal",
                           command=self.xview,
                           width=16)
        ysb = tk.Scrollbar(self.master,
                           orient="vertical",
                           command=self.yview,
                           width=16)
        self.configure(yscrollcommand=ysb.set, xscrollcommand=xsb.set)
        self.configure(scrollregion=(0, 0, 1000, 1000))

        xsb.grid(row=1, column=0, sticky="ew")
        ysb.grid(row=0, column=1, sticky="ns")
        self.grid(column=0, row=0, sticky="nsew")
        self.master.grid_rowconfigure(0, weight=1)
        self.master.grid_columnconfigure(0, weight=1)

        # mockup/placeholder till the real one comes
        self.create_text(221,
                         75,
                         text='Riccardo Saverio Grimaldo',
                         font=('Times', 16),
                         fill=formats['fg'])
        self.create_line(351, 73, 377, 73, fill=formats['fg'])
        self.create_line(351, 77, 377, 77, fill=formats['fg'])
        self.create_text(447,
                         75,
                         text='Bellissa Ricci',
                         font=('Times', 16),
                         fill=formats['fg'])
        self.create_line(365, 90, 365, 115, fill=formats['fg'])
        self.create_text(
            # 221, 75,
            621,
            75,
            text='Donald Wiley Webb',
            font=('Times', 16),
            fill=formats['fg'])
        self.create_line(715, 73, 741, 73, fill=formats['fg'])
        self.create_line(715, 77, 741, 77, fill=formats['fg'])
        self.create_text(847,
                         75,
                         text='Maria Tabitha Mullinax',
                         font=('Times', 16),
                         fill=formats['fg'])
        self.create_line(580, 102, 726, 102, fill=formats['fg'])
        self.create_line(580, 102, 580, 115, fill=formats['fg'])
        self.create_line(726, 90, 726, 103, fill=formats['fg'])
        self.create_text(356,
                         125,
                         text='Jeremiah Laurence Grimaldo',
                         font=('Times', 16),
                         fill=formats['fg'],
                         tags='current_person')
        self.create_line(486, 123, 514, 123, fill=formats['fg'])
        self.create_line(486, 127, 514, 127, fill=formats['fg'])
        self.create_text(582,
                         125,
                         text='Ronnie Webb',
                         font=('Times', 16),
                         fill=formats['fg'])
        self.create_line(500, 140, 500, 165, fill=formats['fg'])
        self.create_line(350, 165, 650, 165, fill=formats['fg'])
        self.create_line(350, 165, 350, 190, fill=formats['fg'])
        self.create_line(650, 165, 650, 190, fill=formats['fg'])
        self.create_text(350,
                         205,
                         text='Patricia Grimaldo',
                         font=('Times', 16),
                         fill=formats['fg'])
        self.create_text(650,
                         205,
                         text='Christiana Dalia Grimaldo',
                         font=('Times', 16),
                         fill=formats['fg'])

        # enable panning with mouse
        self.bind("<ButtonPress-1>", scroll_start)
        self.bind("<B1-Motion>", scroll_move)

        rcm_widgets = (self, )
        make_rc_menus(rcm_widgets, self.rc_menu, pedigree_person_tab_msg)

        config_generic(self)