Python Tkinter.W Examples

The following are 30 code examples of Tkinter.W(). 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: annotation_gui.py    From SEM with MIT License 9 votes vote down vote up
def preferences(self, event=None):
        preferenceTop = tkinter.Toplevel()
        preferenceTop.focus_set()
        
        notebook = ttk.Notebook(preferenceTop)
        
        frame1 = ttk.Frame(notebook)
        notebook.add(frame1, text='general')
        frame2 = ttk.Frame(notebook)
        notebook.add(frame2, text='shortcuts')

        c = ttk.Checkbutton(frame1, text="Match whole word when broadcasting annotation", variable=self._whole_word)
        c.pack()
        
        shortcuts_vars = []
        shortcuts_gui = []
        cur_row = 0
        j = -1
        frame_list = []
        frame_list.append(ttk.LabelFrame(frame2, text="common shortcuts"))
        frame_list[-1].pack(fill="both", expand="yes")
        for i, shortcut in enumerate(self.shortcuts):
            j += 1
            key, cmd, bindings = shortcut
            name, command = cmd
            shortcuts_vars.append(tkinter.StringVar(frame_list[-1], value=key))
            tkinter.Label(frame_list[-1], text=name).grid(row=cur_row, column=0, sticky=tkinter.W)
            entry = tkinter.Entry(frame_list[-1], textvariable=shortcuts_vars[j])
            entry.grid(row=cur_row, column=1)
            cur_row += 1
        notebook.pack()
    
    #
    # ? menu methods
    # 
Example #2
Source File: eddn.py    From EDMarketConnector with GNU General Public License v2.0 7 votes vote down vote up
def plugin_prefs(parent, cmdr, is_beta):

    PADX = 10
    BUTTONX = 12	# indent Checkbuttons and Radiobuttons
    PADY = 2		# close spacing

    output = config.getint('output') or (config.OUT_MKT_EDDN | config.OUT_SYS_EDDN)	# default settings

    eddnframe = nb.Frame(parent)

    HyperlinkLabel(eddnframe, text='Elite Dangerous Data Network', background=nb.Label().cget('background'), url='https://github.com/EDSM-NET/EDDN/wiki', underline=True).grid(padx=PADX, sticky=tk.W)	# Don't translate
    this.eddn_station= tk.IntVar(value = (output & config.OUT_MKT_EDDN) and 1)
    this.eddn_station_button = nb.Checkbutton(eddnframe, text=_('Send station data to the Elite Dangerous Data Network'), variable=this.eddn_station, command=prefsvarchanged)	# Output setting
    this.eddn_station_button.grid(padx=BUTTONX, pady=(5,0), sticky=tk.W)
    this.eddn_system = tk.IntVar(value = (output & config.OUT_SYS_EDDN) and 1)
    this.eddn_system_button = nb.Checkbutton(eddnframe, text=_('Send system and scan data to the Elite Dangerous Data Network'), variable=this.eddn_system, command=prefsvarchanged)	# Output setting new in E:D 2.2
    this.eddn_system_button.grid(padx=BUTTONX, pady=(5,0), sticky=tk.W)
    this.eddn_delay= tk.IntVar(value = (output & config.OUT_SYS_DELAY) and 1)
    this.eddn_delay_button = nb.Checkbutton(eddnframe, text=_('Delay sending until docked'), variable=this.eddn_delay)	# Output setting under 'Send system and scan data to the Elite Dangerous Data Network' new in E:D 2.2
    this.eddn_delay_button.grid(padx=BUTTONX, sticky=tk.W)

    return eddnframe 
Example #3
Source File: tkmktap.py    From BitTorrent with GNU General Public License v3.0 6 votes vote down vote up
def setupOptFlags(self):
        self.optFlags = []
        flags = []
        if hasattr(self.options, 'optFlags'):
            flags.extend(self.options.optFlags)

        d = {}
        soFar = {}
        for meth in reflect.prefixedMethodNames(self.options.__class__, 'opt_'):
            full = 'opt_' + meth
            func = getattr(self.options, full)

            if not usage.flagFunction(func) or meth in ('help', 'version'):
                continue
            
            if soFar.has_key(func):
                continue
            soFar[func] = 1
            
            existing = d.setdefault(func, meth)
            if existing != meth:
                if len(existing) < len(meth):
                    d[func] = meth
            
            for (func, name) in d.items():
                flags.append((name, None, func.__doc__))
            
            if len(flags):
                self.optFrame = f = Tkinter.Frame(self)
                for (flag, _, desc) in flags:
                    b = Tkinter.BooleanVar()
                    c = Tkinter.Checkbutton(f, text=desc, variable=b, wraplen=200)
                    c.pack(anchor=Tkinter.W)
                    self.optFlags.append((flag, b))
                f.grid(row=1, column=1) 
Example #4
Source File: dataset.py    From PCWG with MIT License 6 votes vote down vote up
def add_rews(self, master):
                    
        self.addTitleRow(master, "REWS Settings:")
        self.rewsDefined = self.addCheckBox(master, "REWS Active", self.config.rewsDefined)
        self.numberOfRotorLevels = self.addEntry(master, "REWS Number of Rotor Levels:", validation.ValidateNonNegativeInteger(master), self.config.numberOfRotorLevels)
        self.rotorMode = self.addOption(master, "REWS Rotor Mode:", ["EvenlySpacedLevels", "ProfileLevels"], self.config.rotorMode)
        self.hubMode = self.addOption(master, "Hub Mode:", ["Interpolated", "PiecewiseExponent"], self.config.hubMode)                

        label = tk.Label(master, text="REWS Profile Levels:")
        label.grid(row=self.row, sticky=tk.W, column=self.titleColumn, columnspan = 2)
        self.row += 1
        
        self.rewsGridBox = REWSGridBox(master, self, self.row, self.inputColumn)
        self.rewsGridBox.add_items(self.config.rewsProfileLevels)

        self.copyToShearButton = tk.Button(master, text="Copy To Shear", command = self.copyToShearREWSProfileLevels, width=12, height=1)
        self.copyToShearButton.grid(row=self.row, sticky=tk.E+tk.N, column=self.buttonColumn) 
Example #5
Source File: dataset.py    From PCWG with MIT License 6 votes vote down vote up
def body(self, master):

        self.prepareColumns(master)
        self.addTitleRow(master, "REWS Level Settings:")

        self.height = self.addEntry(master, "Height:", validation.ValidatePositiveFloat(master), self.item.height)

        parse_button = tk.Button(master, text="Parse", command = self.parse_height, width=3, height=1)
        parse_button.grid(row=(self.row-1), sticky=tk.N, column=self.inputColumn, padx = 160)

        self.windSpeed = self.addPickerEntry(master, "Wind Speed:", validation.ValidateNotBlank(master), self.item.wind_speed_column, width = 60)
        self.windDirection = self.addPickerEntry(master, "Wind Direction:", None, self.item.wind_direction_column, width = 60)
        self.upflow = self.addPickerEntry(master, "Upflow:", None, self.item.upflow_column, width = 60)

        #dummy label to indent controls
        tk.Label(master, text=" " * 5).grid(row = (self.row-1), sticky=tk.W, column=self.titleColumn) 
Example #6
Source File: dataset.py    From PCWG with MIT License 6 votes vote down vote up
def body(self, master):

        self.prepareColumns(master)     
                
        self.addTitleRow(master, "Calibration Direction Settings:")
        
        self.direction = self.addEntry(master, "Direction:", validation.ValidateFloat(master), self.item.direction)
        self.slope = self.addEntry(master, "Slope:", validation.ValidateFloat(master), self.item.slope)
        self.offset = self.addEntry(master, "Offset:", validation.ValidateFloat(master), self.item.offset)

        if self.item.active:
            self.active = self.addCheckBox(master, "Active:", 1)
        else:
            self.active = self.addCheckBox(master, "Active:", 0)

        #dummy label to indent controls
        tk.Label(master, text=" " * 5).grid(row = (self.row-1), sticky=tk.W, column=self.titleColumn) 
Example #7
Source File: dataset.py    From PCWG with MIT License 6 votes vote down vote up
def body(self, master):

        self.prepareColumns(master)     

        #dummy label to force width
        tk.Label(master, text=" " * 275).grid(row = self.row, sticky=tk.W, column=self.titleColumn, columnspan = 8)
        self.row += 1
        
                
        self.addTitleRow(master, "Exclusion Settings:")
        
        self.startDate = self.addDatePickerEntry(master, "Start Date:", validation.ValidateNotBlank(master), self.item.startDate)
        self.endDate = self.addDatePickerEntry(master, "End Date:", validation.ValidateNotBlank(master), self.item.endDate)

        if self.item.active:
            self.active = self.addCheckBox(master, "Active:", 1)
        else:
            self.active = self.addCheckBox(master, "Active:", 0)

        #dummy label to indent controls
        tk.Label(master, text=" " * 5).grid(row = (self.row-1), sticky=tk.W, column=self.titleColumn) 
Example #8
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 #9
Source File: grid_box.py    From PCWG with MIT License 6 votes vote down vote up
def _set_up_tree_widget(self):

        tree_container = ttk.Frame(self.container)

        tree_container.grid(row=0, column=0, sticky=tk.W+tk.E+tk.N+tk.S)

        #tree_container.pack(fill='both', expand=True)

        # create a treeview with dual scrollbars
        self.tree = ttk.Treeview(tree_container, columns=self.headers, show="headings")
        
        vsb = ttk.Scrollbar(tree_container, orient="vertical", command=self.tree.yview)
        hsb = ttk.Scrollbar(tree_container, orient="horizontal", command=self.tree.xview)

        self.tree.configure(yscrollcommand=vsb.set, xscrollcommand=hsb.set)
        self.tree.grid(column=0, row=0, sticky='nsew')

        vsb.grid(column=1, row=0, sticky='ns')
        hsb.grid(column=0, row=1, sticky='ew')

        tree_container.grid_columnconfigure(0, weight=1)
        tree_container.grid_rowconfigure(0, weight=1)

        self.tree.bind("<Double-1>", self.double_click) 
Example #10
Source File: pcwg_tool_reborn.py    From PCWG with MIT License 6 votes vote down vote up
def addDatePickerEntry(self, master, title, validation, value, width = None):

        if value != None:
            if type(value) == str:
                textValue = value
            else:
                textValue = value.strftime(datePickerFormat)
        else:
            textValue = None
      
        entry = self.addEntry(master, title + " " + datePickerFormatDisplay, validation, textValue, width = width)
        entry.entry.config(state=tk.DISABLED)
        
        pickButton = tk.Button(master, text=".", command = DatePicker(self, entry, datePickerFormat), width=3, height=1)
        pickButton.grid(row=(self.row-1), sticky=tk.N, column=self.inputColumn, padx = 160)

        clearButton = tk.Button(master, text="x", command = ClearEntry(entry), width=3, height=1)
        clearButton.grid(row=(self.row-1), sticky=tk.W, column=self.inputColumn, padx = 133)
                
        entry.bindPickButton(pickButton)

        return entry 
Example #11
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 #12
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 #13
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 #14
Source File: analysis.py    From PCWG with MIT License 5 votes vote down vote up
def add_corrections(self, master):
                                        
        self.turbulenceCorrectionActive = self.addCheckBox(master,
                                                           "Turbulence Correction Active",
                                                           self.config.turbRenormActive)

        self.augment_turbulence_correction = self.addCheckBox(master,
                                                              "Augment Turbulence Correction",
                                                              self.config.augment_turbulence_correction)

        self.powerDeviationMatrixActive = self.addCheckBox(master, "PDM Correction Active", self.config.powerDeviationMatrixActive)               
        
        self.specifiedPowerDeviationMatrix = self.addFileOpenEntry(master, "Specified PDM:", validation.ValidateSpecifiedPowerDeviationMatrix(master, self.powerDeviationMatrixActive), self.config.specified_power_deviation_matrix.absolute_path, self.filePath)

        self.productionByHeightActive = self.addCheckBox(master, "Production By Height Active", self.config.productionByHeightActive)  

        self.web_service_active = self.addCheckBox(master, "Web Service Active", self.config.web_service_active)  
        self.web_service_url = self.addEntry(master, "Web Service URL:", None, self.config.web_service_url, width=100)

        web_service_label = tk.Label(master, text='Available substitutions are: <TurbulenceIntensity>, <NormalisedWindSpeed> & <RotorWindSpeedRatio>')        
        web_service_label.grid(row=self.row, column=self.inputColumn, columnspan=1,sticky=tk.W)
        self.row += 1
        
        web_service_example_label = tk.Label(master, text='e.g. http://www.power.com/<NormalisedWindSpeed>/<TurbulenceIntensity>')        
        web_service_example_label.grid(row=self.row, column=self.inputColumn, columnspan=1,sticky=tk.W)
        self.row += 1 
Example #15
Source File: dataset.py    From PCWG with MIT License 5 votes vote down vote up
def add_specified_calibration(self, master):

        label = tk.Label(master, text="Calibration Sectors:")
        label.grid(row=self.row, sticky=tk.W, column=self.titleColumn, columnspan = 2)
        self.row += 1                

        self.calibrationSectorsGridBox = CalibrationSectorsGridBox(master, self, self.row, self.inputColumn)
        self.calibrationSectorsGridBox.add_items(self.config.calibrationSectors) 
Example #16
Source File: analysis.py    From PCWG with MIT License 5 votes vote down vote up
def add_datasets(self, master):

        self.dataset_grid_box = dataset.DatasetGridBox(master, self, self.row, self.inputColumn, self.config.datasets.clone())
        self.row += 1
        
        self.validate_datasets = validation.ValidateDatasets(master, self.dataset_grid_box)
        self.validations.append(self.validate_datasets)
        self.validate_datasets.messageLabel.grid(row=self.row, sticky=tk.W, column=self.messageColumn) 
Example #17
Source File: base_dialog.py    From PCWG with MIT License 5 votes vote down vote up
def addOption(self, master, title, options, value):

        label = tk.Label(master, text=title)
        label.grid(row=self.row, sticky=tk.W, column=self.labelColumn)

        variable = tk.StringVar(master, value)

        option = apply(tk.OptionMenu, (master, variable) + tuple(options))
        option.grid(row=self.row, column=self.inputColumn, sticky=tk.W)

        self.row += 1

        return variable 
Example #18
Source File: pcwg_tool_reborn.py    From PCWG with MIT License 5 votes vote down vote up
def addFileOpenEntry(self, master, title, validation, value, basePathVariable = None, width = 60):

            variable = self.addEntry(master, title, validation, value, width)

            button = tk.Button(master, text="...", command = SetFileOpenCommand(master, variable, basePathVariable), height=1)
            button.grid(row=(self.row - 1), sticky=tk.E+tk.W, column=self.buttonColumn)

            return variable 
Example #19
Source File: pcwg_tool_reborn.py    From PCWG with MIT License 5 votes vote down vote up
def addFileSaveAsEntry(self, master, title, validation, value, width = 60):

            variable = self.addEntry(master, title, validation, value, width, showHideCommand)

            button = tk.Button(master, text="...", command = SetFileSaveAsCommand(master, variable), height=1)
            button.grid(row=(self.row - 1), sticky=tk.E+tk.W, column=self.buttonColumn)

            return variable 
Example #20
Source File: pcwg_tool_reborn.py    From PCWG with MIT License 5 votes vote down vote up
def addTitleRow(self, master, title):

            tk.Label(master, text=title).grid(row=self.row, sticky=tk.W, column=self.titleColumn, columnspan = 2)

            #add dummy label to stop form shrinking when validation messages hidden
            tk.Label(master, text = " " * 70).grid(row=self.row, sticky=tk.W, column=self.messageColumn)

            self.row += 1 
Example #21
Source File: pcwg_tool_reborn.py    From PCWG with MIT License 5 votes vote down vote up
def addCheckBox(self, master, title, value):

            label = tk.Label(master, text=title)
            label.grid(row=self.row, sticky=tk.W, column=self.labelColumn)
            variable = tk.IntVar(master, value)

            checkButton = tk.Checkbutton(master, variable=variable)
            checkButton.grid(row=self.row, column=self.inputColumn, sticky=tk.W)

            self.row += 1

            return variable 
Example #22
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 #23
Source File: pcwg_tool_reborn.py    From PCWG with MIT License 5 votes vote down vote up
def addOption(self, master, title, options, value):

            label = tk.Label(master, text=title)
            label.grid(row=self.row, sticky=tk.W, column=self.labelColumn)

            variable = tk.StringVar(master, value)

            option = apply(tk.OptionMenu, (master, variable) + tuple(options))
            option.grid(row=self.row, column=self.inputColumn, sticky=tk.W)

            self.row += 1

            return variable 
Example #24
Source File: dataset.py    From PCWG with MIT License 5 votes vote down vote up
def add_filters(self, master):

        #Filters             
        label = tk.Label(master, text="Filters:")
        label.grid(row=self.row, sticky=tk.W, column=self.titleColumn, columnspan = 2)
        self.row += 1     
        
        self.filtersGridBox = FiltersGridBox(master, self, self.row, self.inputColumn)
        self.filtersGridBox.add_items(self.config.filters) 
Example #25
Source File: main.py    From PiPark with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, master = None):
        """Application constructor method. """
        if self.__is_verbose: print "INFO: Application constructor called."

        # run super constructor method
        tk.Frame.__init__(self, master)
        
        # apply grid layout
        self.grid()
        
        # give application a reference to the global camera object
        global camera
        self.__camera = camera
        self.__camera.awb_mode = 'auto'
        self.__camera.exposure_mode = 'auto'
        
        # populate the application WITH W-W-W-WWIDDDDGEETTSS
        self.__createWidgets()
        
        # create canvas to display logo
        self.logo = tk.Canvas(self, width = 400, height = 148)
        self.logo.grid(row = 0, column = 0, rowspan = 1, columnspan = 2)
        self.loadImage("./images/logo_main.jpeg", self.logo, 400/2, 148/2)
        self.updateText()
        
        # create key-press handlers -> set focus to this frame
        self.bind("<Escape>", self.escapePressHandler)
        self.focus_set() 
Example #26
Source File: menotexport-gui.py    From Menotexport with GNU General Public License v3.0 5 votes vote down vote up
def addPathFrame(self):
        frame=Frame(self)
        frame.pack(fill=tk.X,expand=0,side=tk.TOP,padx=8,pady=5)

        frame.columnconfigure(1,weight=1)

        #------------------Database file------------------
        label=tk.Label(frame,text='Mendeley Data file:',\
                bg='#bbb')
        label.grid(row=0,column=0,\
                sticky=tk.W,padx=8)

        self.db_entry=tk.Entry(frame)
        self.db_entry.grid(row=0,column=1,sticky=tk.W+tk.E,padx=8)

        self.db_button=tk.Button(frame,text='Open',command=self.openFile)
        self.db_button.grid(row=0,column=2,padx=8,sticky=tk.E)

        hint='''
Default location on Linux:
~/.local/share/data/Mendeley\ Ltd./Mendeley\ Desktop/your_email@www.mendeley.com.sqlite
Default location on Windows:
C:\Users\Your_name\AppData\Local\Mendeley Ltd\Mendeley Desktop\your_email@www.mendeley.com.sqlite'''

        hint_label=tk.Label(frame,text=hint,\
                justify=tk.LEFT,anchor=tk.NW)
        hint_label.grid(row=1,column=0,columnspan=3,\
                sticky=tk.W,padx=8)

        #--------------------Output dir--------------------
        label2=tk.Label(frame,text='Output folder:',\
                bg='#bbb')
        label2.grid(row=2,column=0,\
                sticky=tk.W,padx=8)

        self.out_entry=tk.Entry(frame)
        self.out_entry.grid(row=2,column=1,sticky=tk.W+tk.E,padx=8)
        self.out_button=tk.Button(frame,text='Choose',command=self.openDir)
        self.out_button.grid(row=2,column=2,padx=8,sticky=tk.E) 
Example #27
Source File: tkgui.py    From ATX with Apache License 2.0 5 votes vote down vote up
def _init_items(self):
        root = self._root
        frm_control = tk.Frame(root, bg='blue')
        frm_control.grid(column=0, row=0)
        frm_screen = tk.Frame(root, bg='#aaa')
        frm_screen.grid(column=0, row=1)

        tk.Button(frm_control, text="Refresh", command=self._redraw).grid(column=0, row=0, sticky=tk.W)
        tk.Button(frm_control, text="Save crop", command=self._save_crop).grid(column=1, row=0, sticky=tk.W)

        self.canvas = tk.Canvas(frm_screen, bg="blue", bd=0, highlightthickness=0, relief='ridge')
        self.canvas.grid(column=0, row=0, padx=10, pady=10)
        self.canvas.bind("<Button-1>", self._stroke_start)
        self.canvas.bind("<B1-Motion>", self._stroke_move)
        self.canvas.bind("<B1-ButtonRelease>", self._stroke_done) 
Example #28
Source File: marmot.py    From aggregation with Apache License 2.0 5 votes vote down vote up
def __thumbnail_display__(self):
        # destroy any previously existing thumbnails - for when we're flipping through pages
        for thumb_index in range(len(self.thumbnails)-1,-1,-1):
            old_thumb = self.thumbnails.pop(thumb_index)
            old_thumb.destroy()

        for ii,subject_id in enumerate(self.subjects[9*self.page_index:9+9*self.page_index]):
            # do we already have a thumb for this file?
            thumb_path = DIR_THUMBS+str(subject_id)+".jpg"
            if not os.path.exists(thumb_path):
                self.__create_thumb__(subject_id)

            render_image = ImageTk.PhotoImage(file=thumb_path)

            but = ttk.Button(self.root, image=render_image)
            but.grid(column=ii/3+1, row=(1+ii)%3,sticky=tkinter.W)

            # the interaction with the subject will depend on whether we have gold standard data for it or not
            # if not, the user will need to create some
            if self.require_gold_standard:
                assert False
                # but.bind('<Button-1>', lambda event,t=thumb_path: self.(t) if self.run_mode == "a" else self.__create_gold_standard__(t))
            else:
                but.bind('<Button-1>', lambda event,t=thumb_path: self.__create_gold_standard__(t))

            self.thumbnails.append(but)

            # sigh - I hate having to do this
            # MUST keep - otherwise garbage collection in Python will remove it
            self.links.append(render_image)

        # todo - this window is not actually popping up
        # determine which of the subjects we are interested in have actually been processed
        # we may need to do some additional aggregation
        aggregated_subjects = self.project.__get_aggregated_subjects__(-1)

        not_aggregated = [s for s in self.subjects[:self.step_size] if s not in aggregated_subjects]

        # print not_aggregated
        if not_aggregated != []:
            self.project.__aggregate__([-1],self.subjects[:self.step_size]) 
Example #29
Source File: dataset.py    From PCWG with MIT License 5 votes vote down vote up
def body(self, master):

        self.prepareColumns(master)                       
                
        self.addTitleRow(master, "Shear measurement:")
        
        self.height = self.addEntry(master, "Height:", validation.ValidatePositiveFloat(master), self.item.height)                
        self.windSpeed = self.addPickerEntry(master, "Wind Speed:", validation.ValidateNotBlank(master), self.item.wind_speed_column, width = 60)
        
        #dummy label to indent controls
        tk.Label(master, text=" " * 5).grid(row = (self.row-1), sticky=tk.W, column=self.titleColumn) 
Example #30
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()