Python tkinter.FLAT Examples

The following are 17 code examples of tkinter.FLAT(). 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: order_display.py    From hwk-mirror with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent, subindex, **kwargs):
        # relief, bg, insertbackground hides its... Entryness.
        super().__init__(parent,
                text="",            
                relief=tk.FLAT, 
                bg=parent["bg"],
                insertbackground=parent["bg"],
                highlightcolor="red",
                state="readonly", 
                selectbackground=parent["bg"], # so text doesn't have a highlight box
                width=Order.longest_item,
                **kwargs)
        self._text = tk.StringVar(self)
        self.configure(textvariable=self._text)
        self.selected = False
        self.subindex = subindex
        self.index = None
        self.bind("<Button-1>", self.on_press)
        self.bind("<FocusIn>", self.on_focus_in)
        self.bind("<FocusOut>", self.on_focus_out) 
Example #2
Source File: DockManager.py    From python-in-practice with GNU General Public License v3.0 6 votes vote down vote up
def undock(self, dock, x=None, y=None):
        """Warning: On Mac OS X 10.5 undocking works imperfectly.
        Left and right docking work fine though.
        """
        dock.pack_forget()
        dock.config(relief=tk.FLAT, borderwidth=0)
        dock.tk.call("wm", "manage", dock)
        on_close = dock.register(dock.on_close)
        dock.tk.call("wm", "protocol", dock, "WM_DELETE_WINDOW", on_close)
        title = dock.title if hasattr(dock, "title") else "Dock"
        dock.tk.call("wm", "title", dock, title)
        minsize = dock.minsize if hasattr(dock, "minsize") else (60, 30)
        dock.tk.call("wm", "minsize", dock, *minsize)
        dock.tk.call("wm", "resizable", dock, False, False)
        if TkUtil.windows():
            dock.tk.call("wm", "attributes", dock, "-toolwindow", True)
        if x is not None and y is not None:
            self.xy_for_dock[dock] = (x, y)
        x, y = self.xy_for_dock.get(dock, (None, None))
        if x is not None and y is not None:
            dock.tk.call("wm", "geometry", dock, "{:+}{:+}".format(x, y))
        self.__remove_area(dock) 
Example #3
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 #4
Source File: tkwidgets.py    From hwk-mirror with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent, char, font=("Courier", 14)):
        super().__init__(parent,
                bd=2,
                relief=tk.RAISED,
                bg="black",
                fg="white",
                font=font)

        if not char.strip():
            self["state"] = tk.DISABLED    
            self["relief"] = tk.FLAT
            self["bd"] = 0
        
        self.char = char
        self.target = None
        self.configure(text=self.char, command=self.on_press)
        
        Key.all_keys.append(self) 
Example #5
Source File: view.py    From inbac with MIT License 5 votes vote down vote up
def create_menu(self):
        self.menu: Menu = Menu(self.master, relief=tk.FLAT)
        self.menu.add_command(label="Open", command=self.open_dialog)
        self.menu.add_command(
            label="Settings", command=self.create_settings_window)
        self.menu.add_command(label="About", command=self.show_about_dialog)
        self.menu.add_separator()
        self.menu.add_command(label="Exit", command=self.master.quit)
        self.master.config(menu=self.menu) 
Example #6
Source File: zynthian_gui_info.py    From zynthian-ui with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
		self.shown=False
		self.zyngui=zynthian_gui_config.zyngui

		# Main Frame
		self.main_frame = tkinter.Frame(zynthian_gui_config.top,
			width = zynthian_gui_config.display_width,
			height = zynthian_gui_config.display_height,
			bg = zynthian_gui_config.color_bg)

		#Textarea
		self.textarea = tkinter.Text(self.main_frame,
			height = int(zynthian_gui_config.display_height/(zynthian_gui_config.font_size+8)),
			font=(zynthian_gui_config.font_family,zynthian_gui_config.font_size,"normal"),
			#wraplength=80,
			#justify=tkinter.LEFT,
			bd=0,
			highlightthickness=0,
			relief=tkinter.FLAT,
			cursor="none",
			bg=zynthian_gui_config.color_bg,
			fg=zynthian_gui_config.color_tx)
		self.textarea.bind("<Button-1>", self.cb_push)
		#self.textarea.pack(fill="both", expand=True)
		self.textarea.place(x=0,y=0)

		self.textarea.tag_config("ERROR", foreground="#C00000")
		self.textarea.tag_config("WARNING", foreground="#FF9000")
		self.textarea.tag_config("SUCCESS", foreground="#009000")
		self.textarea.tag_config("EMPHASIS", foreground="#0000C0") 
Example #7
Source File: order_display.py    From hwk-mirror with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, master, **kwargs):
        super().__init__(master,
                 text="", bd=2,
                 width=8, relief=tk.FLAT,
                 anchor=tk.CENTER, **kwargs)
        self.command = self._command
        self.item = None 
Example #8
Source File: order_display.py    From hwk-mirror with GNU General Public License v3.0 5 votes vote down vote up
def update(self, item):
        price = item.price + sum(item.options.get(opt, 0) for opt in item.selected_options)
        if item.name:
            self["relief"] = tk.RAISED
            self["text"] = type(self).fmt(price / 100)
        else:
            self["relief"] = tk.FLAT
            self["text"] = "" 
Example #9
Source File: console.py    From hwk-mirror with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, interpreter='/bin/bash', width=80, **kwargs):
        super().__init__(parent, **kwargs)
        scrollbar = tk.Scrollbar(self)
        self.interpreter = interpreter
        self.output = Output(self, relief=tk.FLAT, highlightthickness=0, yscrollcommand=scrollbar.set)
        scrollbar.config(command=self.output.yview)
        scrollbar.grid(row=0, column=3, rowspan=2, sticky="ns")
        self.output.grid(row=0, column=0, columnspan=2)
        self.read = self.output.read 
Example #10
Source File: ticketbox.py    From hwk-mirror with GNU General Public License v3.0 5 votes vote down vote up
def reset(self):
        self.item_info.reset()
        self.addon1_info.reset()
        self.addon2_info.reset()
        self.ticket_no["relief"] = tk.FLAT
        self["relief"] = tk.FLAT 
Example #11
Source File: client-test2.py    From The-chat-room with MIT License 5 votes vote down vote up
def express():
    global b1, b2, b3, b4, ee
    if ee == 0:
        ee = 1
        b1 = tkinter.Button(root, command=bb1, image=p1,
                            relief=tkinter.FLAT, bd=0)
        b2 = tkinter.Button(root, command=bb2, image=p2,
                            relief=tkinter.FLAT, bd=0)
        b3 = tkinter.Button(root, command=bb3, image=p3,
                            relief=tkinter.FLAT, bd=0)
        b4 = tkinter.Button(root, command=bb4, image=p4,
                            relief=tkinter.FLAT, bd=0)

        b1.place(x=5, y=248)
        b2.place(x=75, y=248)
        b3.place(x=145, y=248)
        b4.place(x=215, y=248)
    else:
        ee = 0
        b1.destroy()
        b2.destroy()
        b3.destroy()
        b4.destroy()


# 创建表情按钮 
Example #12
Source File: view.py    From inbac with MIT License 5 votes vote down vote up
def __init__(self, master: Tk, initial_window_size: Tuple[int, int]):
        self.master: Tk = master
        self.frame: Frame = tk.Frame(self.master, relief=tk.FLAT)
        self.frame.pack(fill=tk.BOTH, expand=tk.YES)
        self.image_canvas: Canvas = Canvas(self.frame, highlightthickness=0)
        self.image_canvas.pack(fill=tk.BOTH, expand=tk.YES)
        self.master.geometry(
            str(initial_window_size[0]) + "x" + str(initial_window_size[1]))
        self.master.update()
        self.controller = None

        self.bind_events()
        self.create_menu() 
Example #13
Source File: adder.py    From mentalist with MIT License 5 votes vote down vote up
def open_special_dlg(self):
        '''Open a popup for selecting special characters
        '''
        self.special_dlg = Tk.Toplevel()
        self.special_dlg.withdraw()
        self.special_dlg.title('Select Special Characters')
        self.special_dlg.resizable(width=False, height=False)
        frame = Tk.Frame(self.special_dlg)
        lb = Tk.Label(frame, text='Select Special Characters'.format(self.title))
        lb.pack(fill='both', side='top')

        box = Tk.Frame(frame)
        self.chk_special = []
        max_column_checks = 15
        for v, val in enumerate(SPECIAL_CHARACTERS):
            var = Tk.IntVar()
            tmp = Tk.Checkbutton(box, text=val, relief=Tk.FLAT, variable=var)
            self.chk_special.append(var)
            tmp.grid(row=v % max_column_checks, column=v // max_column_checks,
                     sticky='W', padx=10)
        box.pack(fill='both', side='top', padx=30, pady=20)

        # Ok and Cancel buttons
        btn_box = Tk.Frame(frame)
        btn_cancel = Tk.Button(btn_box, text='Cancel', command=self.cancel_special)
        btn_cancel.pack(side='right', padx=10, pady=20)
        btn_ok = Tk.Button(btn_box, text='Ok', command=self.on_ok_special_dlg)
        btn_ok.pack(side='left', padx=10, pady=20)
        btn_box.pack()
        frame.pack(fill='both', padx=60, pady=10)
        
        center_window(self.special_dlg, self.main.master)
        self.special_dlg.focus_set() 
Example #14
Source File: client-test.py    From The-chat-room with MIT License 5 votes vote down vote up
def express():
    global b1, b2, b3, b4, ee
    if ee == 0:
        ee = 1
        b1 = tkinter.Button(root, command=bb1, image=p1,
                            relief=tkinter.FLAT, bd=0)
        b2 = tkinter.Button(root, command=bb2, image=p2,
                            relief=tkinter.FLAT, bd=0)
        b3 = tkinter.Button(root, command=bb3, image=p3,
                            relief=tkinter.FLAT, bd=0)
        b4 = tkinter.Button(root, command=bb4, image=p4,
                            relief=tkinter.FLAT, bd=0)

        b1.place(x=5, y=248)
        b2.place(x=75, y=248)
        b3.place(x=145, y=248)
        b4.place(x=215, y=248)
    else:
        ee = 0
        b1.destroy()
        b2.destroy()
        b3.destroy()
        b4.destroy()


# 创建表情按钮 
Example #15
Source File: client.py    From The-chat-room with MIT License 5 votes vote down vote up
def express():
    global b1, b2, b3, b4, ee
    if ee == 0:
        ee = 1
        b1 = tkinter.Button(root, command=bb1, image=p1,
                            relief=tkinter.FLAT, bd=0)
        b2 = tkinter.Button(root, command=bb2, image=p2,
                            relief=tkinter.FLAT, bd=0)
        b3 = tkinter.Button(root, command=bb3, image=p3,
                            relief=tkinter.FLAT, bd=0)
        b4 = tkinter.Button(root, command=bb4, image=p4,
                            relief=tkinter.FLAT, bd=0)

        b1.place(x=5, y=248)
        b2.place(x=75, y=248)
        b3.place(x=145, y=248)
        b4.place(x=215, y=248)
    else:
        ee = 0
        b1.destroy()
        b2.destroy()
        b3.destroy()
        b4.destroy()


# 创建表情按钮 
Example #16
Source File: adder.py    From mentalist with MIT License 4 votes vote down vote up
def open_date_dlg(self):
        '''Open a popup for defining a range of dates
        '''
        self.custom_num_window = Tk.Toplevel()
        self.custom_num_window.withdraw()
        self.custom_num_window.title('{}: Date Selection'.format(self.title))
        self.custom_num_window.resizable(width=False, height=False)
        frame = Tk.Frame(self.custom_num_window)
        lb = Tk.Label(frame, text='Select Dates to {}'.format(self.title))
        lb.pack(fill='both', side='top')

        # Boxes for inputting the start and endpoints
        sp_box = Tk.Frame(frame)
        lb1 = Tk.Label(sp_box, text='From')
        lb1.pack(side='left', padx=5)
        cur_year = datetime.date.today().year
        self.sp_from = Tk.Spinbox(sp_box, width=12, from_=1950, to=cur_year)
        self.sp_from.pack(side='left')
        lb2 = Tk.Label(sp_box, text='To')
        lb2.pack(side='left', padx=(50, 5))
        var = Tk.IntVar()
        var.set(str(cur_year))
        self.sp_to = Tk.Spinbox(sp_box, width=12, from_=1950, to=cur_year, textvariable=var)
        self.sp_to.pack(side='right')
        sp_box.pack(fill='both', side='top', padx=30, pady=20)

        # Choose how the dates are formatted (mmddyyyy etc.)
        drop_down = Tk.OptionMenu(frame, self.date_format, *DATE_FORMATS)
        drop_down.configure(width=max(map(len, DATE_FORMATS)) + 4)
        self.date_format.set('mmddyy')
        drop_down.pack(side='top')
        
        self.date_zero_padding = Tk.IntVar()
        checkbutton = Tk.Checkbutton(frame, text='Leading zero on single-digit d or m', relief=Tk.FLAT, variable=self.date_zero_padding)
        checkbutton.pack()
        
        # Ok and cancel buttons
        btn_box = Tk.Frame(frame)
        btn_cancel = Tk.Button(btn_box, text='Cancel', command=self.cancel_custom_num_window)
        btn_cancel.pack(side='right', padx=10, pady=20)
        btn_ok = Tk.Button(btn_box, text='Ok', command=self.on_ok_date_window)
        btn_ok.pack(side='left', padx=10, pady=20)
        btn_box.pack()
        
        frame.pack(fill='both', padx=10, pady=10)
        
        center_window(self.custom_num_window, self.main.master)
        self.custom_num_window.focus_set() 
Example #17
Source File: substitution.py    From mentalist with MIT License 4 votes vote down vote up
def open_sub_popup(self, type_):
        '''Opens popup for defining the characters to substitute
        type_: 'All', 'First', or 'Last'
        '''
        self.sub_popup = Tk.Toplevel()
        self.sub_popup.withdraw()
        self.sub_popup.title('Replace {}'.format(type_))
        self.sub_popup.resizable(width=False, height=False)
        frame = Tk.Frame(self.sub_popup)
        lb = Tk.Label(frame, text='Select Substitution Checks'.format(self.title))
        lb.pack(fill='both', side='top')

        # Create a checkbox for each possible character substitution
        box = Tk.Frame(frame)
        self.chk_subs = []
        max_column_checks = 15
        for v in range(len(SUBSTITUTION_CHECKS)):
            val = SUBSTITUTION_CHECKS[v]
            var = Tk.IntVar()
            tmp = Tk.Checkbutton(box, text=val, relief=Tk.FLAT, variable=var,
                                 font=('Courier', '14'))
            self.chk_subs.append(var)
            
            # Split the checks into columns so the window isn't too tall
            tmp.grid(row=v % max_column_checks, column=v // max_column_checks,
                     sticky='W', padx=10)
        box.pack(fill='both', side='top', padx=30, pady=20)

        box_type = Tk.Frame(frame)
        self.sub_type = Tk.IntVar()
        for i, val in enumerate(SPECIAL_TYPES):
            tmp = Tk.Radiobutton(box_type, text=val, relief=Tk.FLAT, variable=self.sub_type, value=i)
            tmp.pack(fill='both', side='left')
        box_type.pack(fill='both', side='top', padx=30, pady=20)

        btn_box = Tk.Frame(frame)
        btn_cancel = Tk.Button(btn_box, text='Cancel', command=self.cancel_sub_popup)
        btn_cancel.pack(side='right', padx=10, pady=20)
        btn_ok = Tk.Button(btn_box, text='Ok', command=partial(self.on_ok_sub_popup, type_))
        btn_ok.pack(side='left', padx=10, pady=20)
        btn_box.pack()
        frame.pack(fill='both', padx=40, pady=10)
        
        center_window(self.sub_popup, self.main.master)
        self.sub_popup.focus_set()