Python tkinter.Entry() Examples

The following are 30 code examples of tkinter.Entry(). 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: viewer.py    From networkx_viewer with GNU General Public License v3.0 7 votes vote down vote up
def __init__(self, main_window, msg='Please enter a node:'):
        tk.Toplevel.__init__(self)
        self.main_window = main_window
        self.title('Node Entry')
        self.geometry('170x160')
        self.rowconfigure(3, weight=1)

        tk.Label(self, text=msg).grid(row=0, column=0, columnspan=2,
                                      sticky='NESW',padx=5,pady=5)
        self.posibilities = [d['dataG_id'] for n,d in
                    main_window.canvas.dispG.nodes_iter(data=True)]
        self.entry = AutocompleteEntry(self.posibilities, self)
        self.entry.bind('<Return>', lambda e: self.destroy(), add='+')
        self.entry.grid(row=1, column=0, columnspan=2, sticky='NESW',padx=5,pady=5)

        tk.Button(self, text='Ok', command=self.destroy).grid(
            row=3, column=0, sticky='ESW',padx=5,pady=5)
        tk.Button(self, text='Cancel', command=self.cancel).grid(
            row=3, column=1, sticky='ESW',padx=5,pady=5)

        # Make modal
        self.winfo_toplevel().wait_window(self) 
Example #3
Source File: workflowcreator.py    From CEASIOMpy with Apache License 2.0 6 votes vote down vote up
def __init__(self, master=None, **kwargs):

        tk.Frame.__init__(self, master, **kwargs)
        self.pack(fill=tk.BOTH)

        self.Options = WorkflowOptions()

        space_label = tk.Label(self, text=' ')
        space_label.grid(column=0, row=0)

        # Input CPACS file
        self.label = tk.Label(self, text='  Input CPACS file')
        self.label.grid(column=0, row=1)

        self.path_var = tk.StringVar()
        self.path_var.set(self.Options.cpacs_path)
        value_entry = tk.Entry(self, textvariable=self.path_var, width= 45)
        value_entry.grid(column=1, row=1)

        self.browse_button = tk.Button(self, text="Browse", command=self._browse_file)
        self.browse_button.grid(column=2, row=1, pady=5)

        # Notebook for tabs
        self.tabs = ttk.Notebook(self)
        self.tabs.grid(column=0, row=2, columnspan=3,padx=10,pady=10)

        self.TabPre = Tab(self, 'Pre')
        self.TabOptim = Tab(self, 'Optim')
        self.TabPost = Tab(self, 'Post')

        self.tabs.add(self.TabPre, text=self.TabPre.name)
        self.tabs.add(self.TabOptim, text=self.TabOptim.name)
        self.tabs.add(self.TabPost, text=self.TabPost.name)

        # General buttons
        self.close_button = tk.Button(self, text='Save & Quit', command=self._save_quit)
        self.close_button.grid(column=2, row=3) 
Example #4
Source File: ch1-6.py    From Tkinter-GUI-Programming-by-Example with MIT License 6 votes vote down vote up
def __init__(self):
        super().__init__()
        self.title("Hello Tkinter")
        self.label_text = tk.StringVar()
        self.label_text.set("My Name Is: ")

        self.name_text = tk.StringVar()

        self.label = tk.Label(self, textvar=self.label_text)
        self.label.pack(fill=tk.BOTH, expand=1, padx=100, pady=10)

        self.name_entry = tk.Entry(self, textvar=self.name_text)
        self.name_entry.pack(fill=tk.BOTH, expand=1, padx=20, pady=20)

        hello_button = tk.Button(self, text="Say Hello", command=self.say_hello)
        hello_button.pack(side=tk.LEFT, padx=(20, 0), pady=(0, 20))

        goodbye_button = tk.Button(self, text="Say Goodbye", command=self.say_goodbye)
        goodbye_button.pack(side=tk.RIGHT, padx=(0, 20), pady=(0, 20)) 
Example #5
Source File: price_display.py    From hwk-mirror with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent, text, textvariable, **kwargs):
        super().__init__(parent, **kwargs)
        self.label = tk.Label(self, 
                text=text,
                font=self.font,
                anchor=tk.E)
        
        self.entry = tk.Entry(self,
                textvariable=textvariable,
                font=self.font,
                width=len("$ 000.00"),
                state=tk.DISABLED,
                disabledforeground="black",
                disabledbackground="white")

        self.label.grid(row=0, column=0, sticky="nswe")
        self.entry.grid(row=0, column=1, sticky="nswe") 
Example #6
Source File: options_frame_gui.py    From pyDEA with MIT License 6 votes vote down vote up
def set_multi_tol(self):
        ''' Sets the value of Entry with multiplier model tolerance
            according to a given value
            if this value is valid (non-negative float). If the given value
            is invalid, a warning is displayed.
        '''
        tol_str = self.params.get_parameter_value('MULTIPLIER_MODEL_TOLERANCE')
        try:
            tol = float(tol_str)
            if (tol < 0):
                self._show_multi_tol_warning(tol_str)
                self.multi_tol_strvar.set('0')
            else:
                self.multi_tol_strvar.set(tol_str)
        except ValueError:
            self._show_multi_tol_warning(tol_str)
            self.multi_tol_strvar.set('0') 
Example #7
Source File: download_cl1024_images.py    From pythonprojects with MIT License 6 votes vote down vote up
def __init__(self, root=None, **args):
        super(DownloadFrame, self).__init__(root=root, **args)
        self.entry = tk.StringVar()
        self.cnt = 0
        self.num = tk.StringVar()
        self.num.set(300)
        self.name = 0
        self.flag = False

        row = 0

        tk.Label(self.root, text='----请输入要下载的免翻地址---').grid(row=row, column=1)

        row += 1
        tk.Label(self.root,width=10, justify='right' ,text='地址').grid(row=row, column=0)
        tk.Entry(self.root, textvariable=self.entry, width=24).grid(row=row, column=1)
        tk.Button(self.root, width=9,text='下载图片', command=self.downloadnow).grid(row=row, column=2)


        row += 1

        tk.Label(self.root,   text='---代理功能更新中---').grid(row=row, column=1) 
Example #8
Source File: recipe-577525.py    From code with MIT License 6 votes vote down vote up
def __init__(self, master):
        # Initialize the Frame object.
        super().__init__(master)
        # Create every opening widget.
        self.intro = Label(self, text=self.PROMPT)
        self.group = LabelFrame(self, text='Filename')
        self.entry = Entry(self.group, width=35)
        self.click = Button(self.group, text='Browse ...', command=self.file)
        self.enter = Button(self, text='Continue', command=self.start)
        # Make Windows entry bindings.
        def select_all(event):
            event.widget.selection_range(0, tkinter.END)
            return 'break'
        self.entry.bind('<Control-Key-a>', select_all)
        self.entry.bind('<Control-Key-/>', lambda event: 'break')
        # Position them in this frame.
        options = {'sticky': tkinter.NSEW, 'padx': 5, 'pady': 5}
        self.intro.grid(row=0, column=0, **options)
        self.group.grid(row=1, column=0, **options)
        self.entry.grid(row=0, column=0, **options)
        self.click.grid(row=0, column=1, **options)
        self.enter.grid(row=2, column=0, **options) 
Example #9
Source File: console.py    From hwk-mirror with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent):
        super().__init__(parent)
        var = tk.StringVar(self)
        label = tk.Label(self, text="$ ", width=2, bg="grey26", fg="white", relief=tk.FLAT, bd=0)
        self.entry = entry = tk.Entry(self, 
                width=78,
                bg="grey26",
                fg="white",
                relief=tk.FLAT,
                bd=0,
                highlightthickness=0,
                textvariable=var,
                insertbackground="white")
        
        label.grid(row=1, column=0)
        entry.grid(row=1, column=1)
        self.set = var.set
        self.get = var.get
        entry.bind("<Return>", self.on_enter) 
Example #10
Source File: pynpuzzle.py    From pynpuzzle with MIT License 6 votes vote down vote up
def draw_puzzle(puzzle_frame, n, read_only=False):
    """
    Fills a frame widget with n + 1 entry widget.

    puzzle_frame : The puzzle frame to get filled by entry widgets.
    n : Puzzle type (n-puzzle).
    read_only : Should widgets be read-only or not
    """
    n = int(math.sqrt(n + 1))

    for i in range(n):
        for j in range(n):
            entry = tkinter.Entry(puzzle_frame, width=4, justify='center')
            entry.grid(row=i, column=j, sticky='WENS')

            if read_only:
                # Bind the widget validation command to return_false_validate command and therefore
                #   OUTPUT_EDITABLE global variable.
                entry.config(validatecommand=return_false_validate, validate=tkinter.ALL)

        puzzle_frame.grid_columnconfigure(i, weight=1)
        puzzle_frame.grid_rowconfigure(i, weight=1) 
Example #11
Source File: ttk.py    From Fluid-Designer with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, master=None, widget=None, **kw):
        """Constructs a Ttk Entry widget with the parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus, xscrollcommand

        WIDGET-SPECIFIC OPTIONS

            exportselection, invalidcommand, justify, show, state,
            textvariable, validate, validatecommand, width

        VALIDATION MODES

            none, key, focus, focusin, focusout, all
        """
        Widget.__init__(self, master, widget or "ttk::entry", kw) 
Example #12
Source File: ttk.py    From ironpython3 with Apache License 2.0 6 votes vote down vote up
def __init__(self, master=None, widget=None, **kw):
        """Constructs a Ttk Entry widget with the parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus, xscrollcommand

        WIDGET-SPECIFIC OPTIONS

            exportselection, invalidcommand, justify, show, state,
            textvariable, validate, validatecommand, width

        VALIDATION MODES

            none, key, focus, focusin, focusout, all
        """
        Widget.__init__(self, master, widget or "ttk::entry", kw) 
Example #13
Source File: update_gui.py    From Trade-Dangerous with Mozilla Public License 2.0 6 votes vote down vote up
def addInput(self, item, defValue, row):
        pos = len(row)
        
        inputVal = tk.StringVar()
        inputVal.set(str(defValue))
        
        inputEl = tk.Entry(self.interior,
                width=10,
                justify=tk.RIGHT,
                textvariable=inputVal)
        inputEl.item = item
        inputEl.row = row
        inputEl.pos = pos
        inputEl.val = inputVal
        
        inputEl.bind('<Shift-Key-Tab>', self.onShiftTab)
        inputEl.bind('<Key-Tab>', self.onTab)
        inputEl.bind('<Key-Return>', self.onReturn)
        inputEl.bind('<Key-Down>', self.onDown)
        inputEl.bind('<Key-Up>', self.onUp)
        inputEl.bind('<FocusOut>', lambda evt: self.validateRow(evt.widget.row))
        self.addWidget(inputEl, sticky='E')
        row.append((inputEl, inputVal)) 
Example #14
Source File: options.py    From hwk-mirror with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent, item, **kwargs):
        super().__init__(parent, **kwargs)
        self.grid_columnconfigure(0, weight=1)
        label = tk.Label(self, font=self.font, text=f"{item.name}", width=25, justify=tk.LEFT, anchor=tk.NW)
        self.ticket = item
        self.options = [lib.ToggleSwitch(self, text=option, font=self.font, width=15) for option in item.options]
        self._comments = tk.StringVar(self)
        comment = item.parameters.get("comments", "")
        self._comments.set(comment if comment else "Comments")
        self.comments = tk.Entry(self, textvariable=self._comments, font=self.font)
        self.grid_columnconfigure(0, weight=1)

        label.grid(row=0, column=0, columnspan=2, sticky="nswe", padx=5, pady=5)
        tk.Label(self, text="    ", font=self.font).grid(row=1, column=0, sticky="nswe")
        for i, option in enumerate(self.options):
            if option["text"] in item.selected_options:
                option.state = True
            option.grid(row=i+1, column=1, sticky="nwe", padx=5, pady=5)
        
        self.grid_rowconfigure(len(self.options) + 2, weight=1)
        self.comments.grid(row=len(self.options) + 2, column=0, columnspan=2, pady=5, padx=5, sticky="swe")
        self.comments.bind("<FocusIn>", self.on_entry_focus) 
Example #15
Source File: lineSettingsFrame.py    From PyEveLiveDPS with GNU General Public License v3.0 6 votes vote down vote up
def addLine(self, settingsList, dpsFrame):
        lineNumber = len(settingsList)
        settingsList.append({"transitionValue": "", "color": "#FFFFFF"})
        settingsList[lineNumber]["transitionValue"] = tk.StringVar()
        settingsList[lineNumber]["transitionValue"].set(str(100*lineNumber))
              
        removeButton = tk.Button(dpsFrame, text="X", command=lambda:self.removeLine(lineNumber, settingsList, dpsFrame))
        font = tkFont.Font(font=removeButton['font'])
        font.config(weight='bold')
        removeButton['font'] = font
        removeButton.grid(row=lineNumber, column="0")
        lineLabel = tk.Label(dpsFrame, text="Threshold when the line changes color:")
        lineLabel.grid(row=lineNumber, column="1")
        initialThreshold = tk.Entry(dpsFrame, textvariable=settingsList[lineNumber]["transitionValue"], width=10)
        initialThreshold.grid(row=lineNumber, column="2")
        initialLabel = tk.Label(dpsFrame, text="Color:")
        initialLabel.grid(row=lineNumber, column="3")
        colorButton = tk.Button(dpsFrame, text="    ", 
                                command=lambda:self.colorWindow(settingsList[lineNumber], colorButton), 
                                bg=settingsList[lineNumber]["color"])
        colorButton.grid(row=lineNumber, column="4") 
Example #16
Source File: test_widgets.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def create(self, **kwargs):
        return tkinter.Entry(self.root, **kwargs) 
Example #17
Source File: ttk.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, master=None, **kw):
        """Construct a Ttk Combobox widget with the parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS

            exportselection, justify, height, postcommand, state,
            textvariable, values, width
        """
        Entry.__init__(self, master, "ttk::combobox", **kw) 
Example #18
Source File: ttk.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def __init__(self, master=None, **kw):
        """Construct a Ttk Combobox widget with the parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS

            exportselection, justify, height, postcommand, state,
            textvariable, values, width
        """
        Entry.__init__(self, master, "ttk::combobox", **kw) 
Example #19
Source File: checkout_display.py    From hwk-mirror with GNU General Public License v3.0 5 votes vote down vote up
def labeled_entry(self, text, variable, state=tk.DISABLED, **kwargs):
        frame = tk.Frame(self, **kwargs)
        label = tk.Label(frame, font=self.font, text=text)
        entry = tk.Entry(frame, 
                font=self.font,
                textvariable=variable,
                state=state,
                width=10,
                disabledbackground="white",
                disabledforeground="black")
                
        label.grid(row=0, column=0, sticky="nse")
        entry.grid(row=0, column=1, sticky="nsw")
        return frame 
Example #20
Source File: ahenkmessage.py    From ahenk with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self, message, title, host):

        self.message = message
        self.title = title
        self.host = host
        self.master = tk.Tk()
        self.master.title(self.title)

        if self.host != "":
            pass
        else:
             tk.Label(self.master, text="Etki Alanı Sunucusu : ").grid(row=0)
             self.e1 = tk.Entry(self.master)
             self.e1.grid(row=0, column=1)

        tk.Label(self.master, text="Yetkili Kullanıcı : ").grid(row=1)
        tk.Label(self.master, text="Parola : ").grid(row=2)

        self.e2 = tk.Entry(self.master)
        self.e3 = tk.Entry(show="*")

        self.var1 = IntVar()
        Checkbutton(self.master, text="Active Directory", variable=self.var1, command=self.check1).grid(row=3, column=0, stick=tk.W,
                                                                                         pady=4)
        self.var2 = IntVar()
        self.var2.set(1)
        Checkbutton(self.master, text="OpenLDAP", variable=self.var2, command=self.check2).grid(row=3, column=1, stick=tk.W, pady=4)


        self.e2.grid(row=1, column=1)
        self.e3.grid(row=2, column=1)

        tk.Button(self.master, text='Çıkış', command=self.master.quit).grid(row=4, column=0, sticky=tk.W, pady=4)
        tk.Button(self.master, text='Tamam', command=self.show).grid(row=4, column=1, sticky=tk.W, pady=4)
        tk.mainloop() 
Example #21
Source File: nsf2x.py    From nsf2x with GNU General Public License v2.0 5 votes vote down vote up
def configDirectoryEntry(self, SetDefaultPath=True):
        """Gui Directory Entry Configuration"""
        self.startButton.config(text=_("Convert"), state=tkinter.NORMAL)
        self.entryPassword.config(state=tkinter.DISABLED)
        self.formatTypeEML.config(state=tkinter.NORMAL)
        self.formatTypeMBOX.config(state=tkinter.NORMAL)
        self.formatTypePST.config(state=tkinter.NORMAL)
        self.optionsButton.config(state=tkinter.NORMAL)

        if SetDefaultPath:
            op = None
            try:
                op = os.path.join(os.path.dirname(self.Lotus.URLDatabase.FilePath), 'archive')
            except (pywintypes.com_error, OSError): # pylint: disable=E1101
                try:
                    op = os.path.join(os.path.expanduser('~'), 'archive')
                except OSError:
                    op = None
            finally:
                if os.path.exists(op):
                    self.nsfPath = op
                else:
                    self.nsfPath = '.'

            sp = os.path.join(os.path.expanduser('~'), 'Documents')
            if os.path.exists(sp):
                self.destPath = sp
            else:
                self.destPath = '.'

        self.chooseNsfButton.config(text=_("Source directory is : %s") % self.nsfPath)
        self.chooseNsfButton.config(state=tkinter.NORMAL)
        self.chooseDestButton.config(text=_("Destination directory is %s") % self.destPath)
        self.chooseDestButton.config(state=tkinter.NORMAL) 
Example #22
Source File: legofy_gui.py    From Legofy with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.chosenFile = None
        self.chosenFilePath = tk.StringVar()

        self.pathField = tk.Entry(self, width=40, textvariable=self.chosenFilePath, state=tk.DISABLED)
        self.pathField.grid(row=0, column=0, padx=10)

        self.selectFile = tk.Button(self, text="Choose file...", command=self.choose_a_file)
        self.selectFile.grid(row=0, column=1)

        self.groupFrame = tk.LabelFrame(self, text="Params", padx=5, pady=5)
        self.groupFrame.grid(row=1, column=0, columnspan=2, )

        self.colorPaletteLabel = tk.Label(self.groupFrame, text = 'Color Palette')
        self.colorPaletteLabel.grid(row=0, column=0 )

        self.colorPalette = ttk.Combobox(self.groupFrame)
        self.colorPalette['values'] = LEGO_PALETTE
        self.colorPalette.current(0)
        self.colorPalette.grid(row=0, column=1)

        self.brickNumberScale = tk.Scale(self.groupFrame, from_=1, to=200, orient=tk.HORIZONTAL, label="Number of bricks (longer edge)", length=250)
        self.brickNumberScale.set(30)
        self.brickNumberScale.grid(row=1, column=0, columnspan=2, )

        self.convertFile = tk.Button(text="Legofy this image!", command=self.convert_file)
        self.convertFile.grid(row=2, column=0, columnspan=2) 
Example #23
Source File: options_frame_gui.py    From pyDEA with MIT License 5 votes vote down vote up
def on_multi_tol_change(self, *args):
        ''' Updates parameter MULTIPLIER_MODEL_TOLERANCE in the parameter
            object when the user
            modifies the content of the Entry widget that stores
            multiplier model tolerance.

            Args:
                *args: are provided by the StringVar trace method and are
                    ignored in this method.
        '''
        # this parameter will be validated before run
        tol_str = self.multi_tol_strvar.get()
        self.params.update_parameter('MULTIPLIER_MODEL_TOLERANCE', tol_str) 
Example #24
Source File: server_widgets.py    From hwk-mirror with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, **kwargs):
        super().__init__(parent, **kwargs)
        label = tk.Label(self, text="Current Time: ", font=self.font)
        variable = tk.StringVar(self)
        entry = tk.Entry(self, textvariable=variable,
                font=self.font,
                state=tk.DISABLED,
                disabledforeground="black",
                disabledbackground="white")
        label.grid(row=0, column=0, sticky="nswe")
        entry.grid(row=0, column=1, sticky="nswe")
        self.set = variable.set
        self.get = variable.get 
Example #25
Source File: checkout_display.py    From hwk-mirror with GNU General Public License v3.0 5 votes vote down vote up
def ticket_number(self, **kwargs):
        frame = tk.Frame(self.interior, **kwargs)
        label = tk.Label(frame, text="Next Ticket", font=self.font)
        entry = tk.Entry(frame, 
                textvariable=self._ticket,
                font=self.font,
                width=5,
                state=tk.DISABLED,
                disabledforeground="black",
                disabledbackground="white")
        label.grid(row=0, column=0, sticky="nswe")
        entry.grid(row=0, column=1, sticky="nswe")
        return frame 
Example #26
Source File: 6.08.py    From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License 5 votes vote down vote up
def draw_text_options(self):
        tk.Label(self.top_bar, text='Text:').pack(side="left")
        self.text_entry_widget = tk.Entry(self.top_bar, width=20)
        self.text_entry_widget.pack(side="left")
        tk.Label(self.top_bar, text='Font size:').pack(side="left")
        self.font_size_spinbox = tk.Spinbox(
            self.top_bar, from_=14, to=100, width=3)
        self.font_size_spinbox.pack(side="left")
        self.create_fill_options_combobox()
        self.create_text_button = tk.Button(
            self.top_bar, text="Go", command=self.on_create_text_button_clicked)
        self.create_text_button.pack(side="left", padx=5) 
Example #27
Source File: menu_editor.py    From hwk-mirror with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, keyboard, font=None,**kwargs):
        super().__init__(parent, **kwargs)
        if font is None:
            font = type(self).font
        type(self).font = font

        self.keyboard = keyboard
        self.on_add = lib.LabelButton.null_cmd
        self._payment_type = tk.StringVar(self)
        self.entry = tk.Entry(self,
                textvariable=self._payment_type,
                font=self.font,
                width=15)
        self.add_button = lib.LabelButton(self,
                text="Add",
                command=self.on_add,
                font=self.font)
        self.entry.grid(row=0,
                column=0,
                sticky="nswe",
                pady=4, padx=2,
                ipady=2, ipadx=2)
        self.add_button.grid(
                row=0,
                column=1,
                pady=4, padx=2,
                ipady=2, ipadx=2)

        self.bind("<FocusIn>", self.on_focus_in) 
Example #28
Source File: menu_editor.py    From hwk-mirror with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, font=("Courier", 14), **kwargs):
        super().__init__(parent, **kwargs)
        self._item = tk.StringVar(self)
        self._price = tk.StringVar(self)
        self.item_entry = tk.Entry(self, textvariable=self._item, font=font)
        self.price_entry = tk.Entry(self, textvariable=self._price, width=5, font=font)
        self.item_entry.grid(row=0, column=0, sticky="nswe", padx=2)
        self.price_entry.grid(row=0, column=1, sticky="nswe", padx=2)
        self.item_entry.bind("<FocusIn>", self.acquire(self.item_entry))
        self.price_entry.bind("<FocusIn>", self.acquire(self.price_entry)) 
Example #29
Source File: progress_tab.py    From hwk-mirror with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, **kwargs):
        super().__init__(parent, **kwargs) 
        self.widgets = WidgetCache(TicketEditor, self, initial_size=4)
        
        tk.Label(self, width=3, font=ItemEditor.font).grid(row=0, column=0, sticky="nswe", padx=2, ipadx=2)
        self.calculator_frame = tk.Frame(self, bd=2, relief=tk.RIDGE)
        self.calculator = EditorCalculator(self.calculator_frame)
        self._difference = tk.StringVar(self)

        self.difference_label = tk.Label(self.calculator_frame, text="Difference ", font=ItemEditor.font)
        self.difference_entry = tk.Entry(self.calculator_frame, 
                textvariable=self._difference,
                font=ItemEditor.font,
                state=tk.DISABLED,
                disabledforeground="black",
                disabledbackground="white",
                width=10)
        
        self.difference_label.grid(row=0, column=0, sticky="w")
        self.difference_entry.grid(row=0, column=1, sticky="w")
        self.calculator.grid(row=1, column=0, sticky="w", columnspan=2)

        self.calculator_frame.grid(row=0, column=1, sticky="nswe", columnspan=2, pady=2, padx=2)
        self.ticket_no = None
        self.orderprogress = None
        self.is_gridded = False
        self.original_total = None 
Example #30
Source File: tkwidgets.py    From hwk-mirror with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, master, text=None, textvariable=None, font=None, state=None, **kwargs):
        super().__init__(master, **kwargs)
        if textvariable is None:
            textvariable = tk.StringVar(self)    
        if text is None:
            text = ""
        self._sv = textvariable
        self.entry = tk.Entry(self, textvariable=self._sv, font=font, state=state)
        self.label = tk.Label(self, text=text, font=font)
        self.entry.grid(row=0, column=1, sticky="nswe")
        self.label.grid(row=0, column=0, sticky="nswe")