Python Tkinter.S Examples

The following are 13 code examples of Tkinter.S(). 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: main.py    From PiPark with GNU General Public License v2.0 6 votes vote down vote up
def __createWidgets(self):
        """Create the widgets. """
        if self.__is_verbose: print "INFO: Creating Widgets!"
        
        # create show preview button
        self.preview_button = tk.Button(self, text = "Show Camera Feed",
            command = self.clickStartPreview)
        self.preview_button.grid(row = 1, column = 0, 
            sticky = tk.W + tk.E + tk.N + tk.S)
        
        # create quit button
        self.quit_button = tk.Button(self, text = "Quit",
            command = self.clickQuit)
        self.quit_button.grid(row = 1, column = 1, 
            sticky = tk.W + tk.E + tk.N + tk.S)
    
    # --------------------------------------------------------------------------
    #   Load Image
    # -------------------------------------------------------------------------- 
Example #2
Source File: view.py    From ms_deisotope with Apache License 2.0 6 votes vote down vote up
def configure_canvas(self):
        self.figure = Figure(dpi=100)
        self.canvas = FigureCanvasTkAgg(self.figure, master=self)
        self.axis = self.figure.add_subplot(111)
        self.canvas.draw()
        canvas_widget = self.canvas.get_tk_widget()
        canvas_widget.grid(row=0, column=0, sticky=tk.N + tk.W + tk.E + tk.S)
        self.canvas_cursor = Cursor(self.axis, tk.StringVar(master=self.root))
        self.canvas.mpl_connect('motion_notify_event', self.canvas_cursor.mouse_move)
        self.span = SpanSelector(
            self.axis, self.zoom, 'horizontal', useblit=True,
            rectprops=dict(alpha=0.5, facecolor='red'))
        self.mz_span = None
        self.scan = None
        self.annotations = []
        self.canvas.draw() 
Example #3
Source File: view.py    From ms_deisotope with Apache License 2.0 6 votes vote down vote up
def configure_treeview(self):
        self.treeview = ttk.Treeview(self)
        self.treeview['columns'] = ["id", "time", 'ms_level', 'precursor_mz', 'precursor_charge', 'activation']
        self.treeview.grid(row=2, column=0, sticky=tk.S + tk.W + tk.E + tk.N)

        self.treeview_scrollbar = ttk.Scrollbar(self, orient="vertical", command=self.treeview.yview)
        self.treeview_scrollbar.grid(row=2, column=0, sticky=tk.S + tk.E + tk.N)
        self.treeview.configure(yscrollcommand=self.treeview_scrollbar.set)

        self.treeview.heading('id', text="Scan ID")
        self.treeview.heading('#0', text='Index')
        self.treeview.heading("time", text='Time (min)')
        self.treeview.heading("ms_level", text='MS Level')
        self.treeview.heading("precursor_mz", text='Precursor M/Z')
        self.treeview.heading("precursor_charge", text='Precursor Z')
        self.treeview.heading("activation", text='Activation')
        self.treeview.column("#0", width=75)
        self.treeview.column("ms_level", width=75)
        self.treeview.column("time", width=75)
        self.treeview.column("precursor_mz", width=100)
        self.treeview.column("precursor_charge", width=100)
        self.treeview.bind("<<TreeviewSelect>>", self.on_row_click) 
Example #4
Source File: viewer.py    From minecart with MIT License 6 votes vote down vote up
def __init__(self, master=None, cnf=None, **kwargs):
        self.frame = ttk.Frame(master)
        self.frame.grid_rowconfigure(0, weight=1)
        self.frame.grid_columnconfigure(0, weight=1)
        self.xbar = AutoScrollbar(self.frame, orient=tkinter.HORIZONTAL)
        self.xbar.grid(row=1, column=0,
                       sticky=tkinter.E + tkinter.W)
        self.ybar = AutoScrollbar(self.frame)
        self.ybar.grid(row=0, column=1,
                       sticky=tkinter.S + tkinter.N)
        tkinter.Canvas.__init__(self, self.frame, cnf or {},
                                xscrollcommand=self.xbar.set,
                                yscrollcommand=self.ybar.set,
                                **kwargs)
        tkinter.Canvas.grid(self, row=0, column=0,
                            sticky=tkinter.E + tkinter.W + tkinter.N + tkinter.S)
        self.xbar.config(command=self.xview)
        self.ybar.config(command=self.yview)
        self.bind("<MouseWheel>", self.on_mousewheel) 
Example #5
Source File: view.py    From ms_deisotope with Apache License 2.0 5 votes vote down vote up
def do_layout(self):
        self.grid(sticky=tk.N + tk.W + tk.E + tk.S)
        tk.Grid.rowconfigure(self, 0, weight=1)
        tk.Grid.columnconfigure(self, 0, weight=1) 
Example #6
Source File: pncview.py    From pseudonetcdf with GNU Lesser General Public License v3.0 5 votes vote down vote up
def gettime(ifile):
    from PseudoNetCDF import PseudoNetCDFVariable
    from datetime import datetime, timedelta
    if 'time' in ifile.variables:
        time = ifile.variables['time']
        unit = time.units
        tunit, datestr = unit.split(' since ')
        sdate = datetime.strptime(datestr.replace(
            ' UTC', ''), '%Y-%m-%d %H:%M:%S')
        time = np.array([sdate + timedelta(**{tunit: t}) for t in time[:]])
        unit = 'time'
    elif 'TFLAG' in ifile.variables:
        x = ifile.variables['TFLAG'][:].copy()
        for axi in range(1, x.ndim - 1):
            x = x[:, 0]
        time = np.array(
            [(datetime.strptime('%07d %06d' % (d, t), '%Y%j %H%M%S'))
             for d, t in x])
        unit = 'time'
    elif 'time' in ifile.dimensions:
        time = np.arange(len(ifile.dimensions['time']))
        unit = 'steps'
    elif 'TSTEP' in ifile.dimensions:
        time = np.arange(1, len(ifile.dimensions['TSTEP']) + 1)
        unit = 'steps'
    else:
        raise KeyError('No time found')
    return PseudoNetCDFVariable(None, 'time', 'f', ('time',),
                                values=time[:], units=unit) 
Example #7
Source File: marmot.py    From aggregation with Apache License 2.0 5 votes vote down vote up
def __run__(self):
        # create the welcome window
        run_type = None
        t = tkinter.Toplevel(self.root)
        t.resizable(False,False)
        frame = ttk.Frame(t, padding="3 3 12 12")
        frame.grid(column=0, row=0, sticky=(tkinter.N, tkinter.W, tkinter.E, tkinter.S))
        frame.columnconfigure(0, weight=1)
        frame.rowconfigure(0, weight=1)
        ttk.Label(frame,text="Welcome to Marmot.").grid(column=1,row=1)
        def setup(require_gold_standard):
            # this will determine the whole run mode from here on in
            self.require_gold_standard = require_gold_standard
            self.subjects = self.__image_select__(require_gold_standard)
            # if r == "a":
            #     self.subjects = self.project.__get_retired_subjects__(1,True)
            #     self.run_mode = "a"
            # else:
            #     # when we want to explore subjects which don't have gold standard
            #     # basically creating some as we go
            #     # False => read in all subjects, not just those with gold standard annotations
            #     # todo - takes a while in read in all subjects. Better way?
            #     self.subjects = self.project.__get_retired_subjects__(1,False)
            #     self.run_mode = "b"
            random.shuffle(self.subjects)

            self.__thumbnail_display__()
            self.__add_buttons__()

            t.destroy()

        ttk.Button(frame, text="Explore results using existing expert annotations", command = lambda : setup(True)).grid(column=1, row=2)
        ttk.Button(frame, text="Explore and create gold standard on the fly", command = lambda : setup(False)).grid(column=1, row=3)

        t.lift(self.root)

        # self.outputButtons()
        self.root.mainloop() 
Example #8
Source File: pcwg_tool_reborn.py    From PCWG with MIT License 5 votes vote down vote up
def addListBox(self, master, title):
            
            scrollbar =  tk.Scrollbar(master, orient=tk.VERTICAL)
            tipLabel = tk.Label(master, text="")
            tipLabel.grid(row = self.row, sticky=tk.W, column=self.tipColumn)                
            lb = tk.Listbox(master, yscrollcommand=scrollbar, selectmode=tk.EXTENDED, height=3)  
            
            self.listboxEntries[title] = ListBoxEntry(lb,scrollbar,tipLabel)              
            self.row += 1
            self.listboxEntries[title].scrollbar.configure(command=self.listboxEntries[title].listbox.yview)
            self.listboxEntries[title].scrollbar.grid(row=self.row, sticky=tk.W+tk.N+tk.S, column=self.titleColumn)
            return self.listboxEntries[title] 
Example #9
Source File: base_dialog.py    From PCWG with MIT License 5 votes vote down vote up
def addListBox(self, master, title, height = 3):
            
        scrollbar =  tk.Scrollbar(master, orient=tk.VERTICAL)
        tipLabel = tk.Label(master, text="")
        tipLabel.grid(row = self.row, sticky=tk.W, column=self.tipColumn)                
        lb = tk.Listbox(master, yscrollcommand=scrollbar, selectmode=tk.EXTENDED, height=height)  
        
        self.listboxEntries[title] = ListBoxEntry(lb,scrollbar,tipLabel)
        self.row += 1

        self.listboxEntries[title].scrollbar.configure(command=self.listboxEntries[title].listbox.yview)
        self.listboxEntries[title].scrollbar.grid(row=self.row, sticky=tk.W+tk.N+tk.S, column=self.titleColumn)
        return self.listboxEntries[title] 
Example #10
Source File: Skeleton_Key.py    From firmware_password_manager with MIT License 4 votes vote down vote up
def master_pane(self):
        """
        The home pane.
        """
        self.logger.info("%s: activated" % inspect.stack()[0][3])
        self.logger.info("%s" % inspect.stack()[1][3])

        self.mainframe = ttk.Frame(self.superframe, width=604, height=510)
        self.mainframe.grid(column=0, row=2, sticky=(N, W, E, S))

        self.mainframe.grid_rowconfigure(0, weight=1)
        self.mainframe.grid_rowconfigure(5, weight=1)
        self.mainframe.grid_columnconfigure(0, weight=1)
        self.mainframe.grid_columnconfigure(2, weight=1)

        self.change_state_btn = ttk.Button(self.mainframe, width=20, text="Change State", command=self.change_state)
        self.change_state_btn.grid(column=0, row=80, pady=4, columnspan=3)
        self.change_state_btn.configure(state=self.state_button_state)

        self.info_status_label = ttk.Label(self.mainframe, text='Location of keyfile:')
        self.info_status_label.grid(column=0, row=90, pady=8, columnspan=3)

        ttk.Button(self.mainframe, width=20, text="Retrieve from JSS Script", command=self.jss_pane).grid(column=0, row=100, pady=4, columnspan=3)

        ttk.Button(self.mainframe, width=20, text="Fetch from Remote Volume", command=self.remote_nav_pane).grid(column=0, row=200, pady=4, columnspan=3)
        ttk.Button(self.mainframe, width=20, text="Retrieve from Local Volume", command=self.local_nav_pane).grid(column=0, row=300, pady=4, columnspan=3)
        ttk.Button(self.mainframe, width=20, text="Enter Firmware Password", command=self.direct_entry_pane).grid(column=0, row=320, pady=4, columnspan=3)

        ttk.Separator(self.mainframe, orient=HORIZONTAL).grid(row=400, columnspan=3, sticky=(E, W), pady=8)

        hash_display = ttk.Entry(self.mainframe, width=58, textvariable=self.hashed_results)
        hash_display.grid(column=0, row=450, columnspan=4)

        self.hash_btn = ttk.Button(self.mainframe, width=20, text="Copy hash to clipboard", command=self.copy_hash)
        self.hash_btn.grid(column=0, row=500, pady=4, columnspan=3)
        self.hash_btn.configure(state=self.hash_button_state)

        ttk.Separator(self.mainframe, orient=HORIZONTAL).grid(row=700, columnspan=3, sticky=(E, W), pady=8)

        self.status_label = ttk.Label(self.mainframe, textvariable=self.status_string)
        self.status_label.grid(column=0, row=2100, sticky=W, columnspan=2)

        ttk.Button(self.mainframe, text="Quit", width=6, command=self.root.destroy).grid(column=2, row=2100, sticky=E) 
Example #11
Source File: Skeleton_Key.py    From firmware_password_manager with MIT License 4 votes vote down vote up
def remote_nav_pane(self):
        """
        Connect to server and select keyfile.
        """
        self.logger.info("%s: activated" % inspect.stack()[0][3])
        self.mainframe.grid_remove()

        try:
            if self.config_options["keyfile"]["remote_type"] == 'smb':
                if self.config_options["keyfile"]["server_path"]:
                    self.remote_hostname.set(self.config_options["keyfile"]["server_path"])

                if self.config_options["keyfile"]["username"]:
                    self.remote_username.set(self.config_options["keyfile"]["username"])

                if self.config_options["keyfile"]["password"]:
                    self.remote_password.set(self.config_options["keyfile"]["password"])
        except:
            pass

        self.remote_nav_frame = ttk.Frame(self.superframe, width=604, height=510)
        self.remote_nav_frame.grid(column=0, row=2, sticky=(N, W, E, S))

        self.remote_nav_frame.grid_columnconfigure(0, weight=1)
        self.remote_nav_frame.grid_columnconfigure(1, weight=1)
        self.remote_nav_frame.grid_columnconfigure(2, weight=1)
        self.remote_nav_frame.grid_columnconfigure(3, weight=1)

        ttk.Label(self.remote_nav_frame, text="Read keyfile from remote server: (ie smb://...)").grid(column=0, row=100, columnspan=4, sticky=(E, W))

        ttk.Label(self.remote_nav_frame, text="Server path:").grid(column=0, row=150, sticky=E)
        hname_entry = ttk.Entry(self.remote_nav_frame, width=30, textvariable=self.remote_hostname)
        hname_entry.grid(column=1, row=150, sticky=W, columnspan=2)

        ttk.Label(self.remote_nav_frame, text="Username:").grid(column=0, row=200, sticky=E)
        uname_entry = ttk.Entry(self.remote_nav_frame, width=30, textvariable=self.remote_username)
        uname_entry.grid(column=1, row=200, sticky=W, columnspan=2)

        ttk.Label(self.remote_nav_frame, text="Password:").grid(column=0, row=250, sticky=E)
        pword_entry = ttk.Entry(self.remote_nav_frame, width=30, textvariable=self.remote_password, show="*")
        pword_entry.grid(column=1, row=250, sticky=W, columnspan=2)

        ttk.Button(self.remote_nav_frame, text="Read keyfile", width=15, default='active', command=self.read_remote).grid(column=1, row=300, columnspan=2, pady=12)

        ttk.Separator(self.remote_nav_frame, orient=HORIZONTAL).grid(row=1000, columnspan=50, pady=12, sticky=(E, W))

        ttk.Button(self.remote_nav_frame, text="Return to home", command=self.master_pane).grid(column=2, row=1100, sticky=E)
        ttk.Button(self.remote_nav_frame, text="Quit", width=6, command=self.root.destroy).grid(column=3, row=1100, sticky=W) 
Example #12
Source File: view.py    From ms_deisotope with Apache License 2.0 4 votes vote down vote up
def configure_display_row(self):
        self.display_row = ttk.Frame(self)
        self.display_row.grid(row=1, column=0, sticky=tk.W + tk.S + tk.E)
        self.cursor_label = ttk.Label(self.display_row, text=" " * 20)
        self.cursor_label.grid(row=0, padx=(10, 10))

        def update_label(*args, **kwargs):
            self.cursor_label['text'] = self.canvas_cursor.binding.get()

        self.canvas_cursor.binding.trace('w', update_label)

        self.ms1_averagine_combobox = ttk.Combobox(self.display_row, values=[
            "peptide",
            "glycan",
            "glycopeptide",
            "heparan sulfate",
        ], width=15)
        self.ms1_averagine_combobox.set("glycopeptide")
        self.ms1_averagine_combobox_label = ttk.Label(self.display_row, text="MS1 Averagine:")
        self.ms1_averagine_combobox_label.grid(row=0, column=1, padx=(10, 0))
        self.ms1_averagine_combobox.grid(row=0, column=2, padx=(1, 10))

        self.msn_averagine_combobox = ttk.Combobox(self.display_row, values=[
            "peptide",
            "glycan",
            "glycopeptide",
            "heparan sulfate",
        ], width=15)
        self.msn_averagine_combobox.set("peptide")
        self.msn_averagine_combobox_label = ttk.Label(self.display_row, text="MSn Averagine:")
        self.msn_averagine_combobox_label.grid(row=0, column=3, padx=(10, 0))
        self.msn_averagine_combobox.grid(row=0, column=4, padx=(1, 10))

        self.ms1_scan_averaging_label = ttk.Label(
            self.display_row, text="MS1 Signal Averaging:")
        self.ms1_scan_averaging_label.grid(row=0, column=5, padx=(10, 0))
        self.ms1_scan_averaging_var = tk.IntVar(self, value=2)
        self.ms1_scan_averaging = ttk.Entry(self.display_row, width=3)
        self.ms1_scan_averaging['textvariable'] = self.ms1_scan_averaging_var
        self.ms1_scan_averaging.grid(row=0, column=6, padx=(1, 3))

        self.min_charge_state_var = tk.IntVar(self, value=1)
        self.max_charge_state_var = tk.IntVar(self, value=12)
        self.min_charge_state_label = ttk.Label(
            self.display_row, text="Min Charge:")
        self.min_charge_state_label.grid(row=0, column=7, padx=(5, 0))
        self.min_charge_state = ttk.Entry(self.display_row, width=3)
        self.min_charge_state['textvariable'] = self.min_charge_state_var
        self.min_charge_state.grid(row=0, column=8, padx=(1, 3))

        self.max_charge_state_label = ttk.Label(
            self.display_row, text="Max Charge:")
        self.max_charge_state_label.grid(row=0, column=9, padx=(5, 0))
        self.max_charge_state = ttk.Entry(self.display_row, width=3)
        self.max_charge_state['textvariable'] = self.max_charge_state_var
        self.max_charge_state.grid(row=0, column=10, padx=(1, 3)) 
Example #13
Source File: marmot.py    From aggregation with Apache License 2.0 4 votes vote down vote up
def __init__(self):
        self.project = Penguins()
        # self.project.__migrate__()

        # tkinter stuff
        self.root = tkinter.Tk()
        self.root.geometry('900x700')
        self.root.title("Marmot")
        self.root.resizable(False,False)

        # ttk stuff - congrads if you understand the difference between tkinter and ttk
        self.mainframe = ttk.Frame(self.root, padding="3 3 12 12")
        self.mainframe.grid(column=0, row=0, sticky=(tkinter.N, tkinter.W, tkinter.E, tkinter.S))
        self.mainframe.columnconfigure(0, weight=1)
        self.mainframe.rowconfigure(0, weight=1)

        self.root.option_add('*tearOff', False)

        self.links = []

        self.true_probabilities = {}
        self.false_probabilities = {}

        self.percentage_thresholds = {}
        self.probability_threshold = {}
        self.weightings = {}

        # might have to truly random - but this way, we don't always download new images
        random.seed(1)
        # store all of the subjects in a random order
        self.subjects = []
        # self.subjects = self.project.__get_retired_subjects__(1,True)
        #
        # random.shuffle(self.subjects)
        self.page_index = 0
        self.step_size = 45


        # see for deleting previous thumbnails when we go to a new page
        self.thumbnails = []

        self.true_positives = {}
        self.false_positives = {}
        self.unknown_positives = {}

        self.run_mode = None

        # used that we can store values when we go back to an image
        self.matplotlib_points = {}
        self.probabilities = {}

        # by default no
        self.require_gold_standard = False