Python Tkinter.NSEW Examples

The following are 14 code examples of Tkinter.NSEW(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module Tkinter , or try the search function .
Example #1
Source File: myNotebook.py    From EDMarketConnector with GNU General Public License v2.0 7 votes vote down vote up
def __init__(self, master=None, **kw):

        ttk.Notebook.__init__(self, master, **kw)
        style = ttk.Style()

        if platform=='darwin':
            if map(int, mac_ver()[0].split('.')) >= [10,10]:
                # Hack for tab appearance with 8.5 on Yosemite & El Capitan. For proper fix see
                # https://github.com/tcltk/tk/commit/55c4dfca9353bbd69bbcec5d63bf1c8dfb461e25
                style.configure('TNotebook.Tab', padding=(12,10,12,2))
                style.map('TNotebook.Tab', foreground=[('selected', '!background', 'systemWhite')])
            self.grid(sticky=tk.NSEW)	# Already padded apropriately
        elif platform == 'win32':
            style.configure('nb.TFrame',                          background=PAGEBG)
            style.configure('nb.TButton',                         background=PAGEBG)
            style.configure('nb.TCheckbutton', foreground=PAGEFG, background=PAGEBG)
            style.configure('nb.TMenubutton',  foreground=PAGEFG, background=PAGEBG)
            style.configure('nb.TRadiobutton', foreground=PAGEFG, background=PAGEBG)
            self.grid(padx=10, pady=10, sticky=tk.NSEW)
        else:
            self.grid(padx=10, pady=10, sticky=tk.NSEW) 
Example #2
Source File: EDMarketConnector.py    From EDMarketConnector with GNU General Public License v2.0 5 votes vote down vote up
def onenter(self, event=None):
        if config.getint('theme') > 1:
            self.w.attributes("-transparentcolor", '')
            self.blank_menubar.grid_remove()
            self.theme_menubar.grid(row=0, columnspan=2, sticky=tk.NSEW) 
Example #3
Source File: EDMarketConnector.py    From EDMarketConnector with GNU General Public License v2.0 5 votes vote down vote up
def onleave(self, event=None):
        if config.getint('theme') > 1 and event.widget==self.w:
            self.w.attributes("-transparentcolor", 'grey4')
            self.theme_menubar.grid_remove()
            self.blank_menubar.grid(row=0, columnspan=2, sticky=tk.NSEW)

# Run the app 
Example #4
Source File: stats.py    From EDMarketConnector with GNU General Public License v2.0 5 votes vote down vote up
def addpage(self, parent, header=[], align=None):
        page = nb.Frame(parent)
        page.grid(pady=10, sticky=tk.NSEW)
        page.columnconfigure(0, weight=1)
        if header:
            self.addpageheader(page, header, align=align)
        return page 
Example #5
Source File: gui_widgets.py    From SVPV with MIT License 5 votes vote down vote up
def __init__(self, parent):
        tk.LabelFrame.__init__(self, parent, text="Plot Custom Range")
        self.parent = parent
        self.lab = tk.Label(self, text='Custom range:')
        self.rangeVar = tk.StringVar(value='chrX:YYYYYY-ZZZZZZ')
        self.entry = tk.Entry(self, textvariable=self.rangeVar, width=25)
        self.setter = tk.Button(self, text="Plot Custom", command=self.do_plot)
        self.lab.grid(row=0, column=0, sticky=tk.NSEW)
        self.entry.grid(row=0, column=1, sticky=tk.NSEW)
        self.setter.grid(row=0, column=2, sticky=tk.NSEW) 
Example #6
Source File: gui_widgets.py    From SVPV with MIT License 5 votes vote down vote up
def __init__(self, parent):
        tk.LabelFrame.__init__(self, parent, text="Filters")
        self.af_filter = AfFilter(self)
        self.gene_filter = GeneFilter(self)
        self.len_filter = LengthFilter(self)
        self.type_filter = SvTypeFilter(self)

        self.af_filter.grid(row=0, sticky=tk.NSEW, columnspan=2)
        self.gene_filter.grid(row=0, column=2, sticky=tk.NSEW)
        self.len_filter.grid(row=0, column=3, sticky=tk.NSEW)
        self.type_filter.grid(row=0, column=4, sticky=tk.NSEW) 
Example #7
Source File: gui_widgets.py    From SVPV with MIT License 5 votes vote down vote up
def __init__(self, parent, svs, sv_count):
        tk.LabelFrame.__init__(self, parent, text="Structural Variant Call Selection")
        self.sv_fl = None
        if not svs:
            self.lab = tk.Label(self,text="-- No matches --")
            self.lab.grid(row=0, column=0, sticky = tk.EW)
            self.num_svs_lab = tk.Label(self, text='-- of %d SVs' % sv_count)
        else:
            self.sv_fl = FieldedListbox(self, ("SV Type", "Chr A", "Pos A", "Chr B", "Pos B", "Length (bp)", "AF"))
            for sv in svs:
                self.sv_fl.push_entry(sv.string_tuple())
            self.num_svs_lab = tk.Label(self, text='%d of %d SVs' % (len(svs), sv_count))
            self.sv_fl.grid(row=0, sticky = tk.NSEW)
        self.num_svs_lab.grid(row=1, column=0, sticky=tk.EW) 
Example #8
Source File: gui.py    From SVPV with MIT License 5 votes vote down vote up
def set_sample_selector(self):
        if self.sample_selector:
            self.sample_selector.destroy()
        self.sample_selector = gw.SampleSelector(self, self.par.run.samples, ped=self.par.run.ped)
        self.sample_selector.grid(row=1, column=0, sticky=tk.NSEW, padx=10) 
Example #9
Source File: gui.py    From SVPV with MIT License 5 votes vote down vote up
def set_genotype_selector(self):
        if self.genotype_selector:
            self.genotype_selector.destroy()
        self.genotype_selector = gw.SampleGenotypeSelector(self, self.current_samples)
        self.genotype_selector.grid(row=1, column=1, sticky=tk.NSEW, padx=10) 
Example #10
Source File: gui.py    From SVPV with MIT License 5 votes vote down vote up
def set_filters(self):
        if self.filters:
            self.filters.destroy()
        self.filters = gw.Filters(self)
        self.filters.grid(row=3, column=0, columnspan=2, sticky=tk.NSEW, pady=2, padx=10) 
Example #11
Source File: gui.py    From SVPV with MIT License 5 votes vote down vote up
def set_sv_chooser(self):
        if self.sv_chooser:
            self.sv_chooser.destroy()
        self.sv_chooser = gw.SvChooser(self, self.svs, self.par.run.vcf.count)
        self.sv_chooser.grid(row=5, column=0, sticky=tk.NSEW, padx=10, columnspan=2) 
Example #12
Source File: gui.py    From SVPV with MIT License 5 votes vote down vote up
def set_info_box(self, message=''):
        if self.info_box:
            self.info_box.destroy()
        self.info_box = gw.InfoBox(self, message)
        self.info_box.grid(row=7, column=0, sticky=tk.NSEW, padx=10, columnspan=2) 
Example #13
Source File: gui.py    From SVPV with MIT License 5 votes vote down vote up
def samples_update(self, idxs):
        self.set_info_box()
        self.current_samples = []
        for idx in idxs:
            self.current_samples.append(self.par.run.samples[int(idx)])
        self.genotype_selector.destroy()
        self.genotype_selector = gw.SampleGenotypeSelector(self, self.current_samples)
        self.genotype_selector.grid(row=1, column=1, sticky=tk.NSEW, padx=10) 
Example #14
Source File: pykms_GuiMisc.py    From py-kms with The Unlicense 4 votes vote down vote up
def show(self):
                def tip_pos_calculator(widget, label, tip_delta = (10, 5), pad = (5, 3, 5, 3)):
                    w = widget
                    s_width, s_height = w.winfo_screenwidth(), w.winfo_screenheight()
                    width, height = (pad[0] + label.winfo_reqwidth() + pad[2],
                                     pad[1] + label.winfo_reqheight() + pad[3])
                    mouse_x, mouse_y = w.winfo_pointerxy()
                    x1, y1 = mouse_x + tip_delta[0], mouse_y + tip_delta[1]
                    x2, y2 = x1 + width, y1 + height

                    x_delta = x2 - s_width
                    if x_delta < 0:
                            x_delta = 0
                    y_delta = y2 - s_height
                    if y_delta < 0:
                            y_delta = 0

                    offscreen = (x_delta, y_delta) != (0, 0)

                    if offscreen:
                        if x_delta:
                                x1 = mouse_x - tip_delta[0] - width
                        if y_delta:
                                y1 = mouse_y - tip_delta[1] - height

                    offscreen_again = y1 < 0  # out on the top

                    if offscreen_again:
                        # No further checks will be done.

                        # TIP:
                        # A further mod might automagically augment the
                        # wraplength when the tooltip is too high to be
                        # kept inside the screen.
                        y1 = 0

                    return x1, y1

                bg = self.bg
                pad = self.pad
                widget = self.widget

                # creates a toplevel window
                self.tw = tk.Toplevel(widget)

                # leaves only the label and removes the app window
                self.tw.wm_overrideredirect(True)

                win = tk.Frame(self.tw, background = bg, borderwidth = 0)
                label = ttk.Label(win, text = self.text, justify = tk.LEFT, background = bg, relief = tk.SOLID, borderwidth = 0,
                                  wraplength = self.wraplength)
                label.grid(padx = (pad[0], pad[2]), pady = (pad[1], pad[3]), sticky=tk.NSEW)
                win.grid()

                x, y = tip_pos_calculator(widget, label)

                self.tw.wm_geometry("+%d+%d" % (x, y))