Python tkinter.SUNKEN Examples

The following are 30 code examples of tkinter.SUNKEN(). 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: program12.py    From python-gui-demos with MIT License 10 votes vote down vote up
def __init__(self, master):
        self.master = master
        self.notebk = ttk.Notebook(self.master)
        self.notebk.pack()
        self.frame1 = ttk.Frame(self.notebk, width = 400, height = 400, relief = tk.SUNKEN)
        self.frame2 = ttk.Frame(self.notebk, width = 400, height = 400, relief = tk.SUNKEN)
        self.notebk.add(self.frame1, text = 'One')
        self.notebk.add(self.frame2, text = 'Two')
        
        self.btn = ttk.Button(self.frame1, text='Add/Insert Tab at Position 1', command = self.AddTab)
        self.btn.pack()
        
        self.btn2 = ttk.Button(self.frame1, text='Disable Tab at Position 1', command = self.disableTab)
        self.btn2.pack()

        strdisplay = r'Tab ID:{}'.format(self.notebk.select())
        ttk.Label(self.frame1, text = strdisplay).pack()
        
        strdisplay2 = 'Tab index:{}'.format(self.notebk.index(self.notebk.select()))
        ttk.Label(self.frame1, text = strdisplay2).pack() 
Example #2
Source File: Main.py    From python-in-practice with GNU General Public License v3.0 7 votes vote down vote up
def create_statusbar(self):
        statusBar = ttk.Frame(self.master)
        statusLabel = ttk.Label(statusBar, textvariable=self.statusText)
        statusLabel.grid(column=0, row=0, sticky=(tk.W, tk.E))
        self.modifiedLabel = ttk.Label(statusBar, relief=tk.SUNKEN,
                anchor=tk.CENTER)
        self.modifiedLabel.grid(column=1, row=0, pady=2, padx=1)
        TkUtil.Tooltip.Tooltip(self.modifiedLabel,
                text="MOD if the text has unsaved changes")
        self.positionLabel = ttk.Label(statusBar, relief=tk.SUNKEN,
                anchor=tk.CENTER)
        self.positionLabel.grid(column=2, row=0, sticky=(tk.W, tk.E),
                pady=2, padx=1)
        TkUtil.Tooltip.Tooltip(self.positionLabel,
                text="Current line and column position")
        ttk.Sizegrip(statusBar).grid(row=0, column=4, sticky=(tk.S, tk.E))
        statusBar.columnconfigure(0, weight=1)
        statusBar.grid(row=2, column=0, columnspan=3, sticky=(tk.W, tk.E))
        self.set_status_text("Start typing to create a new document or "
                "click File→Open") 
Example #3
Source File: turtle.py    From android_universal with MIT License 6 votes vote down vote up
def __init__(self, master, width=500, height=350,
                                          canvwidth=600, canvheight=500):
        TK.Frame.__init__(self, master, width=width, height=height)
        self._rootwindow = self.winfo_toplevel()
        self.width, self.height = width, height
        self.canvwidth, self.canvheight = canvwidth, canvheight
        self.bg = "white"
        self._canvas = TK.Canvas(master, width=width, height=height,
                                 bg=self.bg, relief=TK.SUNKEN, borderwidth=2)
        self.hscroll = TK.Scrollbar(master, command=self._canvas.xview,
                                    orient=TK.HORIZONTAL)
        self.vscroll = TK.Scrollbar(master, command=self._canvas.yview)
        self._canvas.configure(xscrollcommand=self.hscroll.set,
                               yscrollcommand=self.vscroll.set)
        self.rowconfigure(0, weight=1, minsize=0)
        self.columnconfigure(0, weight=1, minsize=0)
        self._canvas.grid(padx=1, in_ = self, pady=1, row=0,
                column=0, rowspan=1, columnspan=1, sticky='news')
        self.vscroll.grid(padx=1, in_ = self, pady=1, row=0,
                column=1, rowspan=1, columnspan=1, sticky='news')
        self.hscroll.grid(padx=1, in_ = self, pady=1, row=1,
                column=0, rowspan=1, columnspan=1, sticky='news')
        self.reset()
        self._rootwindow.bind('<Configure>', self.onResize) 
Example #4
Source File: turtle.py    From Carnets with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def __init__(self, master, width=500, height=350,
                                          canvwidth=600, canvheight=500):
        TK.Frame.__init__(self, master, width=width, height=height)
        self._rootwindow = self.winfo_toplevel()
        self.width, self.height = width, height
        self.canvwidth, self.canvheight = canvwidth, canvheight
        self.bg = "white"
        self._canvas = TK.Canvas(master, width=width, height=height,
                                 bg=self.bg, relief=TK.SUNKEN, borderwidth=2)
        self.hscroll = TK.Scrollbar(master, command=self._canvas.xview,
                                    orient=TK.HORIZONTAL)
        self.vscroll = TK.Scrollbar(master, command=self._canvas.yview)
        self._canvas.configure(xscrollcommand=self.hscroll.set,
                               yscrollcommand=self.vscroll.set)
        self.rowconfigure(0, weight=1, minsize=0)
        self.columnconfigure(0, weight=1, minsize=0)
        self._canvas.grid(padx=1, in_ = self, pady=1, row=0,
                column=0, rowspan=1, columnspan=1, sticky='news')
        self.vscroll.grid(padx=1, in_ = self, pady=1, row=0,
                column=1, rowspan=1, columnspan=1, sticky='news')
        self.hscroll.grid(padx=1, in_ = self, pady=1, row=1,
                column=0, rowspan=1, columnspan=1, sticky='news')
        self.reset()
        self._rootwindow.bind('<Configure>', self.onResize) 
Example #5
Source File: turtle.py    From odoo13-x64 with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, master, width=500, height=350,
                                          canvwidth=600, canvheight=500):
        TK.Frame.__init__(self, master, width=width, height=height)
        self._rootwindow = self.winfo_toplevel()
        self.width, self.height = width, height
        self.canvwidth, self.canvheight = canvwidth, canvheight
        self.bg = "white"
        self._canvas = TK.Canvas(master, width=width, height=height,
                                 bg=self.bg, relief=TK.SUNKEN, borderwidth=2)
        self.hscroll = TK.Scrollbar(master, command=self._canvas.xview,
                                    orient=TK.HORIZONTAL)
        self.vscroll = TK.Scrollbar(master, command=self._canvas.yview)
        self._canvas.configure(xscrollcommand=self.hscroll.set,
                               yscrollcommand=self.vscroll.set)
        self.rowconfigure(0, weight=1, minsize=0)
        self.columnconfigure(0, weight=1, minsize=0)
        self._canvas.grid(padx=1, in_ = self, pady=1, row=0,
                column=0, rowspan=1, columnspan=1, sticky='news')
        self.vscroll.grid(padx=1, in_ = self, pady=1, row=0,
                column=1, rowspan=1, columnspan=1, sticky='news')
        self.hscroll.grid(padx=1, in_ = self, pady=1, row=1,
                column=0, rowspan=1, columnspan=1, sticky='news')
        self.reset()
        self._rootwindow.bind('<Configure>', self.onResize) 
Example #6
Source File: turtle.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, master, width=500, height=350,
                                          canvwidth=600, canvheight=500):
        TK.Frame.__init__(self, master, width=width, height=height)
        self._rootwindow = self.winfo_toplevel()
        self.width, self.height = width, height
        self.canvwidth, self.canvheight = canvwidth, canvheight
        self.bg = "white"
        self._canvas = TK.Canvas(master, width=width, height=height,
                                 bg=self.bg, relief=TK.SUNKEN, borderwidth=2)
        self.hscroll = TK.Scrollbar(master, command=self._canvas.xview,
                                    orient=TK.HORIZONTAL)
        self.vscroll = TK.Scrollbar(master, command=self._canvas.yview)
        self._canvas.configure(xscrollcommand=self.hscroll.set,
                               yscrollcommand=self.vscroll.set)
        self.rowconfigure(0, weight=1, minsize=0)
        self.columnconfigure(0, weight=1, minsize=0)
        self._canvas.grid(padx=1, in_ = self, pady=1, row=0,
                column=0, rowspan=1, columnspan=1, sticky='news')
        self.vscroll.grid(padx=1, in_ = self, pady=1, row=0,
                column=1, rowspan=1, columnspan=1, sticky='news')
        self.hscroll.grid(padx=1, in_ = self, pady=1, row=1,
                column=0, rowspan=1, columnspan=1, sticky='news')
        self.reset()
        self._rootwindow.bind('<Configure>', self.onResize) 
Example #7
Source File: control_helper.py    From faceswap with GNU General Public License v3.0 6 votes vote down vote up
def _color_control(self):
        """ Clickable label holding the currently selected color """
        logger.debug("Add control to Options Frame: (widget: '%s', control: %s, choices: %s)",
                     self.option.name, self.option.control, self.option.choices)
        frame = ttk.Frame(self.frame)
        ctl = tk.Frame(frame,
                       bg=self.option.default,
                       bd=2,
                       cursor="hand2",
                       relief=tk.SUNKEN,
                       width=round(int(20 * get_config().scaling_factor)),
                       height=round(int(12 * get_config().scaling_factor)))
        ctl.bind("<Button-1>", lambda *e, c=ctl, t=self.option.title: self._ask_color(c, t))
        ctl.pack(side=tk.LEFT, anchor=tk.W)
        lbl = ttk.Label(frame, text=self.option.title, width=self.label_width, anchor=tk.W)
        lbl.pack(padx=2, pady=5, side=tk.RIGHT, anchor=tk.N)
        frame.pack(side=tk.LEFT, anchor=tk.W)
        if self.option.helptext is not None:
            _get_tooltip(lbl, text=self.option.helptext, wraplength=600)
        logger.debug("Added control to Options Frame: %s", self.option.name)
        return ctl 
Example #8
Source File: turtle.py    From ironpython3 with Apache License 2.0 6 votes vote down vote up
def __init__(self, master, width=500, height=350,
                                          canvwidth=600, canvheight=500):
        TK.Frame.__init__(self, master, width=width, height=height)
        self._rootwindow = self.winfo_toplevel()
        self.width, self.height = width, height
        self.canvwidth, self.canvheight = canvwidth, canvheight
        self.bg = "white"
        self._canvas = TK.Canvas(master, width=width, height=height,
                                 bg=self.bg, relief=TK.SUNKEN, borderwidth=2)
        self.hscroll = TK.Scrollbar(master, command=self._canvas.xview,
                                    orient=TK.HORIZONTAL)
        self.vscroll = TK.Scrollbar(master, command=self._canvas.yview)
        self._canvas.configure(xscrollcommand=self.hscroll.set,
                               yscrollcommand=self.vscroll.set)
        self.rowconfigure(0, weight=1, minsize=0)
        self.columnconfigure(0, weight=1, minsize=0)
        self._canvas.grid(padx=1, in_ = self, pady=1, row=0,
                column=0, rowspan=1, columnspan=1, sticky='news')
        self.vscroll.grid(padx=1, in_ = self, pady=1, row=0,
                column=1, rowspan=1, columnspan=1, sticky='news')
        self.hscroll.grid(padx=1, in_ = self, pady=1, row=1,
                column=0, rowspan=1, columnspan=1, sticky='news')
        self.reset()
        self._rootwindow.bind('<Configure>', self.onResize) 
Example #9
Source File: turtle.py    From Imogen with MIT License 6 votes vote down vote up
def __init__(self, master, width=500, height=350,
                                          canvwidth=600, canvheight=500):
        TK.Frame.__init__(self, master, width=width, height=height)
        self._rootwindow = self.winfo_toplevel()
        self.width, self.height = width, height
        self.canvwidth, self.canvheight = canvwidth, canvheight
        self.bg = "white"
        self._canvas = TK.Canvas(master, width=width, height=height,
                                 bg=self.bg, relief=TK.SUNKEN, borderwidth=2)
        self.hscroll = TK.Scrollbar(master, command=self._canvas.xview,
                                    orient=TK.HORIZONTAL)
        self.vscroll = TK.Scrollbar(master, command=self._canvas.yview)
        self._canvas.configure(xscrollcommand=self.hscroll.set,
                               yscrollcommand=self.vscroll.set)
        self.rowconfigure(0, weight=1, minsize=0)
        self.columnconfigure(0, weight=1, minsize=0)
        self._canvas.grid(padx=1, in_ = self, pady=1, row=0,
                column=0, rowspan=1, columnspan=1, sticky='news')
        self.vscroll.grid(padx=1, in_ = self, pady=1, row=0,
                column=1, rowspan=1, columnspan=1, sticky='news')
        self.hscroll.grid(padx=1, in_ = self, pady=1, row=1,
                column=0, rowspan=1, columnspan=1, sticky='news')
        self.reset()
        self._rootwindow.bind('<Configure>', self.onResize) 
Example #10
Source File: turtle.py    From Fluid-Designer with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, master, width=500, height=350,
                                          canvwidth=600, canvheight=500):
        TK.Frame.__init__(self, master, width=width, height=height)
        self._rootwindow = self.winfo_toplevel()
        self.width, self.height = width, height
        self.canvwidth, self.canvheight = canvwidth, canvheight
        self.bg = "white"
        self._canvas = TK.Canvas(master, width=width, height=height,
                                 bg=self.bg, relief=TK.SUNKEN, borderwidth=2)
        self.hscroll = TK.Scrollbar(master, command=self._canvas.xview,
                                    orient=TK.HORIZONTAL)
        self.vscroll = TK.Scrollbar(master, command=self._canvas.yview)
        self._canvas.configure(xscrollcommand=self.hscroll.set,
                               yscrollcommand=self.vscroll.set)
        self.rowconfigure(0, weight=1, minsize=0)
        self.columnconfigure(0, weight=1, minsize=0)
        self._canvas.grid(padx=1, in_ = self, pady=1, row=0,
                column=0, rowspan=1, columnspan=1, sticky='news')
        self.vscroll.grid(padx=1, in_ = self, pady=1, row=0,
                column=1, rowspan=1, columnspan=1, sticky='news')
        self.hscroll.grid(padx=1, in_ = self, pady=1, row=1,
                column=0, rowspan=1, columnspan=1, sticky='news')
        self.reset()
        self._rootwindow.bind('<Configure>', self.onResize) 
Example #11
Source File: menu_editor.py    From hwk-mirror with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent, payment_option, **kwargs):
        super().__init__(parent, **kwargs)
        self._payment_type = tk.Label(self,
                text=payment_option,
                font=self.font,
                width=15, 
                relief=tk.SUNKEN,
                bd=2)

        self._remove_bt = lib.LabelButton(self, "remove",
                command=self.remove,
                font=self.font)
        self._payment_type.grid(row=0, column=0, sticky="nswe",
                 pady=2, padx=2, ipady=2, ipadx=2)
        self._remove_bt.grid(row=0, column=1, sticky="nswe", 
                pady=2, padx=2, ipadx=2, ipady=2) 
Example #12
Source File: toggledframe.py    From ttkwidgets with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, master=None, text="", width=20, compound=tk.LEFT, **kwargs):
        """
        Create a ToggledFrame.

        :param master: master widget
        :type master: widget
        :param text: text to display next to the toggle arrow
        :type text: str
        :param width: width of the closed ToggledFrame (in characters)
        :type width: int
        :param compound: "center", "none", "top", "bottom", "right" or "left":
                         position of the toggle arrow compared to the text
        :type compound: str
        :param kwargs: keyword arguments passed on to the :class:`ttk.Frame` initializer
        """
        ttk.Frame.__init__(self, master, **kwargs)
        self._open = False
        self.__checkbutton_var = tk.BooleanVar()
        self._open_image = ImageTk.PhotoImage(Image.open(os.path.join(get_assets_directory(), "open.png")))
        self._closed_image = ImageTk.PhotoImage(Image.open(os.path.join(get_assets_directory(), "closed.png")))
        self._checkbutton = ttk.Checkbutton(self, style="Toolbutton", command=self.toggle,
                                            variable=self.__checkbutton_var, text=text, compound=compound,
                                            image=self._closed_image, width=width)
        self.interior = ttk.Frame(self, relief=tk.SUNKEN)
        self._grid_widgets() 
Example #13
Source File: program12.py    From python-gui-demos with MIT License 6 votes vote down vote up
def AddTab(self):
        if self.btn['text'] == 'Add/Insert Tab at Position 1':
            self.frame3 = ttk.Frame(self.notebk, width = 400, height = 400, relief = tk.SUNKEN)
            self.notebk.insert(1, self.frame3, text = 'Additional Tab')
            self.btn.config(text = 'Remove/Forget Tab')
        else:
            self.notebk.forget(1)
            self.btn.config(text = 'Add/Insert Tab at Position 1') 
Example #14
Source File: program11.py    From python-gui-demos with MIT License 6 votes vote down vote up
def __init__(self, master):
        self.master = master
        self.panedWindow = ttk.Panedwindow(self.master, orient = tk.HORIZONTAL)  # orient panes horizontally next to each other
        self.panedWindow.pack(fill = tk.BOTH, expand = True)    # occupy full master window and enable expand property
        
        self.frame1 = ttk.Frame(self.panedWindow, width = 100, height = 300, relief = tk.SUNKEN)
        self.frame2 = ttk.Frame(self.panedWindow, width = 400, height = 400, relief = tk.SUNKEN)
        
        self.panedWindow.add(self.frame1, weight = 1)
        self.panedWindow.add(self.frame2, weight = 3)
        
        self.button = ttk.Button(self.frame1, text = 'Add frame in Paned Window', command = self.AddFrame)
        self.button.pack() 
Example #15
Source File: program11.py    From python-gui-demos with MIT License 6 votes vote down vote up
def AddFrame(self):
        if self.button['text']=='Add frame in Paned Window':
            self.frame3 = ttk.Frame(self.panedWindow, width = 50, height=400, relief = tk.SUNKEN)
            self.panedWindow.insert(1, self.frame3)     # default weight=0
            self.button.config(text = 'Remove/Forget Added Frame')
        else:
            self.panedWindow.forget(1)
            self.button.config(text = 'Add frame in Paned Window') 
Example #16
Source File: statusbar.py    From vy with MIT License 6 votes vote down vote up
def __init__(self, master):
        Frame.__init__(self, master)
        self.config(border=1)

        self.msg = Label(self, bd=1, relief=SUNKEN, anchor=W)
        self.msg.pack(side='left', expand=True, fill=X)

        self.column = Label(self, bd=1, relief=SUNKEN, anchor=W)
        self.column.config(text='Col: 0')
        self.column.pack(side='right', fill=X)

        self.line = Label(self, bd=1, relief=SUNKEN, anchor=W)
        self.line.config(text='Line: 1')
        self.line.pack(side='right', fill=X)


        self.mode = Label(self, bd=1, relief=SUNKEN, anchor=W)
        self.mode.config(text='Mode: 1')
        self.mode.pack(side='right', fill=X) 
Example #17
Source File: Main.py    From python-in-practice with GNU General Public License v3.0 6 votes vote down vote up
def create_statusbar(self):
        statusBar = ttk.Frame(self.master)
        statusLabel = ttk.Label(statusBar, textvariable=self.statusText)
        statusLabel.grid(column=0, row=0, sticky=(tk.W, tk.E))
        self.modifiedLabel = ttk.Label(statusBar, relief=tk.SUNKEN,
                anchor=tk.CENTER)
        self.modifiedLabel.grid(column=1, row=0, pady=2, padx=1)
        TkUtil.Tooltip.Tooltip(self.modifiedLabel,
                text="MOD if the text has unsaved changes")
        self.positionLabel = ttk.Label(statusBar, relief=tk.SUNKEN,
                anchor=tk.CENTER)
        self.positionLabel.grid(column=2, row=0, sticky=(tk.W, tk.E),
                pady=2, padx=1)
        TkUtil.Tooltip.Tooltip(self.positionLabel,
                text="Current line and column position")
        ttk.Sizegrip(statusBar).grid(row=0, column=4, sticky=(tk.S, tk.E))
        statusBar.columnconfigure(0, weight=1)
        statusBar.grid(row=2, column=0, columnspan=3, sticky=(tk.W, tk.E))
        self.set_status_text("Start typing to create a new document or "
                "click File→Open") 
Example #18
Source File: Main.py    From python-in-practice with GNU General Public License v3.0 5 votes vote down vote up
def create_statusbar(self):
        statusBar = ttk.Frame(self.master)
        statusLabel = ttk.Label(statusBar, textvariable=self.statusText)
        statusLabel.grid(column=0, row=0, sticky=(tk.W, tk.E))
        scoreLabel = ttk.Label(statusBar, textvariable=self.scoreText,
                relief=tk.SUNKEN)
        scoreLabel.grid(column=1, row=0)
        statusBar.columnconfigure(0, weight=1)
        statusBar.pack(side=tk.BOTTOM, fill=tk.X)
        self.set_status_text("Click a tile or click File→New for a new "
                "game") 
Example #19
Source File: toolkit.py    From PickTrue with MIT License 5 votes vote down vote up
def __init__(self, master):
        tk.Frame.__init__(self, master)
        self.variable=tk.StringVar()
        self.label=tk.Label(
            self, bd=1, relief=tk.SUNKEN, anchor=tk.W,
            textvariable=self.variable,
            font=('arial', 16, 'normal')
        )
        self.variable.set('')
        self.label.pack(fill=tk.X)
        self.pack(fill=tk.BOTH) 
Example #20
Source File: chapter7_04.py    From Tkinter-GUI-Application-Development-Cookbook with MIT License 5 votes vote down vote up
def set_selection(self, widget, shape):
        for w in widget.master.winfo_children():
            w.config(relief=tk.RAISED)
        widget.config(relief=tk.SUNKEN)
        self.shape = shape 
Example #21
Source File: box.py    From synthesizer with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self, master, title):
        self.title = title
        super().__init__(master, text=title, padding=4)
        self.player = None   # will be connected later
        self.volumeVar = tk.DoubleVar(value=100)
        self.volumefilter = VolumeFilter()
        ttk.Label(self, text="title / artist / album").pack()
        self.titleLabel = ttk.Label(self, relief=tk.GROOVE, width=22, anchor=tk.W)
        self.titleLabel.pack()
        self.artistLabel = ttk.Label(self, relief=tk.GROOVE, width=22, anchor=tk.W)
        self.artistLabel.pack()
        self.albumlabel = ttk.Label(self, relief=tk.GROOVE, width=22, anchor=tk.W)
        self.albumlabel.pack()
        f = ttk.Frame(self)
        ttk.Label(f, text="time left: ").pack(side=tk.LEFT)
        self.timeleftLabel = ttk.Label(f, relief=tk.GROOVE, anchor=tk.CENTER)
        self.timeleftLabel.pack(side=tk.RIGHT, fill=tk.X, expand=True)
        f.pack(fill=tk.X)
        f = ttk.Frame(self)
        ttk.Label(f, text="V: ").pack(side=tk.LEFT)
        scale = ttk.Scale(f, from_=0, to=150, length=120, variable=self.volumeVar, command=self.on_volumechange)
        scale.bind("<Double-1>", self.on_dblclick_vol)
        scale.pack(side=tk.LEFT)
        self.volumeLabel = ttk.Label(f, text="???%")
        self.volumeLabel.pack(side=tk.RIGHT)
        f.pack(fill=tk.X)
        ttk.Button(self, text="Skip", command=lambda s=self: s.player.skip(s)).pack(pady=4)
        self.volume = 100
        self.stateLabel = tk.Label(self, text="STATE", relief=tk.SUNKEN, border=1)
        self.stateLabel.pack()
        self._track = None
        self._time = None
        self._stream = None
        self._state = self.state_needtrack
        self.state = self.state_needtrack
        self.xfade_state = self.state_xfade_nofade
        self.xfade_started = None
        self.xfade_start_volume = None
        self.playback_started = None
        self.track_duration = None 
Example #22
Source File: chooser.py    From ttkwidgets with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, master=None, **kwargs):
        """
        Create a FontChooser.
        
        :param master: master window
        :type master: widget
        :param kwargs: keyword arguments passed to :class:`tk.Toplevel` initializer
        """
        tk.Toplevel.__init__(self, master, **kwargs)
        self.wm_title("Choose a font")
        self.resizable(False, False)
        self.style = ttk.Style()
        self.style.configure("FontChooser.TLabel", font=("default", 11), relief=tk.SUNKEN, anchor=tk.CENTER)
        self._font_family_header = ttk.Label(self, text="Font family", style="FontChooser.TLabel")
        self._font_family_list = FontFamilyListbox(self, callback=self._on_family, height=8)
        self._font_label_variable = tk.StringVar()
        self._font_label = ttk.Label(self, textvariable=self._font_label_variable, background="white")
        self._font_properties_header = ttk.Label(self, text="Font properties", style="FontChooser.TLabel")
        self._font_properties_frame = FontPropertiesFrame(self, callback=self._on_properties, label=False)
        self._font_size_header = ttk.Label(self, text="Font size", style="FontChooser.TLabel")
        self._size_dropdown = FontSizeDropdown(self, callback=self._on_size, width=4)
        self._example_label = tk.Label(self, text="Example", anchor=tk.CENTER, background="white", height=2,
                                       relief=tk.SUNKEN)

        self._family = None
        self._size = 11
        self._bold = False
        self._italic = False
        self._underline = False
        self._overstrike = False
        self._font = None
        self._ok_button = ttk.Button(self, text="OK", command=self._close)
        self._cancel_button = ttk.Button(self, text="Cancel", command=self._cancel)
        self._grid_widgets() 
Example #23
Source File: Main.py    From python-in-practice with GNU General Public License v3.0 5 votes vote down vote up
def create_statusbar(self):
        statusBar = ttk.Frame(self.master)
        statusLabel = ttk.Label(statusBar, textvariable=self.statusText)
        statusLabel.grid(column=0, row=0, sticky=(tk.W, tk.E))
        scoreLabel = ttk.Label(statusBar, textvariable=self.scoreText,
                relief=tk.SUNKEN)
        scoreLabel.grid(column=1, row=0)
        TkUtil.Tooltip.Tooltip(scoreLabel,
                text="Current score (High score)")
        statusBar.columnconfigure(0, weight=1)
        statusBar.pack(side=tk.BOTTOM, fill=tk.X)
        self.set_status_text("Click a tile or click File→New for a new "
                "game") 
Example #24
Source File: network_status.py    From hwk-mirror with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, text, **kwargs):
        super().__init__(parent, text,
                config_true={"relief": tk.SUNKEN,"bg":"green3"},
                config_false={"relief": tk.RAISED, "bg":"red"},
                font=self.font)
        self.state=False
        # disable user control 
Example #25
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, _in, keyboard, **kwargs):
        super().__init__(parent, **kwargs)
        self.grid_rowconfigure(0, weight=1)
        self.grid_columnconfigure(0, weight=1)
        self.payment_type_editor = PaymentOptionEditorFrame(self)
        PaymentOptionFrame.lst = self.payment_type_editor.widgets
        self.payment_adder = PaymentOptionAdder(self, keyboard, bd=2, relief=tk.SUNKEN)
        self.payment_adder.add_button.command = self.on_add_payment
        self.payment_type_editor.grid(row=0, column=0, rowspan=2, sticky="nswe")
        self.payment_adder.grid(row=3, column=0, sticky="nswe")
        self._in = _in 
Example #26
Source File: lcd.py    From hwk-mirror with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
            super().__init__()
            self.wm_title("LCDScreen")
            frame = tk.Frame(self, bd=5, bg="black", relief=tk.SUNKEN)
            self._screen = [
                _Entry(frame, 
                    width=20, 
                    state=tk.DISABLED,
                    disabledforeground="white",
                    disabledbackground="blue",
                    bd=0,
                    font=("Monospace", 14),
                    highlightthickness=0)
                for i in range(4)
            ]
            self.resizable(0,0)
            self.last_total = None
            
            for i, entry in enumerate(self._screen):
                entry.grid(row=i, column=0, sticky="nswe")
            frame.grid(sticky="nswe")
            
            async def __init__():
                await self.display(" Total: $ 0.00", row=1)
                await self.display("  Cash: - - -", row=2)
                await self.display("Change: - - -", row=3)
            asyncio.run(__init__()) 
Example #27
Source File: tkwidgets.py    From hwk-mirror with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, text, font=None, **kwargs):
        if font is None:
            font = ("Courier", 10)
        super().__init__(parent, text,
                config_true={"relief": tk.SUNKEN,"bg":"green3"},
                config_false={"relief": tk.RAISED, "bg":"red"}, font=font, **kwargs)
        self.state = False
        self.disabled_config = {"fg":"black"} 
Example #28
Source File: tkwidgets.py    From hwk-mirror with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, text, default="grey",state=False,
                config_true={"relief": tk.SUNKEN, "bg":"green"},
                config_false={"relief": tk.RAISED, "bg":"grey"}, **kwargs):
        super().__init__(parent, text, self._cmd, bg=default, **kwargs)
        self._state = None
        self.config_true = config_true
        self.config_false = config_false
        self.state = state 
Example #29
Source File: tkwidgets.py    From hwk-mirror with GNU General Public License v3.0 5 votes vote down vote up
def on_press(self, event):
        self.configure(relief=tk.SUNKEN) 
Example #30
Source File: tkwidgets.py    From hwk-mirror with GNU General Public License v3.0 5 votes vote down vote up
def on_click(self, *args):
        if self._active:
            self.configure(relief=tk.SUNKEN, fg="black")