Python tkinter.ttk 模块,Frame() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用tkinter.ttk.Frame()

项目:Python-GUI-Programming-Cookbook-Second-Edition    作者:PacktPublishing    | 项目源码 | 文件源码
def createWidgets(self):    
        tabControl = ttk.Notebook(self.win)     
        tab1 = ttk.Frame(tabControl)            
        tabControl.add(tab1, text='Tab 1')    
        tabControl.pack(expand=1, fill="both")  
        self.monty = ttk.LabelFrame(tab1, text=' Monty Python ')
        self.monty.grid(column=0, row=0, padx=8, pady=4)        

        scr = scrolledtext.ScrolledText(self.monty, width=30, height=3, wrap=tk.WORD)
        scr.grid(column=0, row=3, sticky='WE', columnspan=3)

        menuBar = Menu(tab1)
        self.win.config(menu=menuBar)
        fileMenu = Menu(menuBar, tearoff=0)
        menuBar.add_cascade(label="File", menu=fileMenu)
        helpMenu = Menu(menuBar, tearoff=0)
        menuBar.add_cascade(label="Help", menu=helpMenu)

        self.createButtons()
项目:pkinter    作者:DeflatedPickle    | 项目源码 | 文件源码
def __init__(self, parent, directory, *args):
        ttk.Frame.__init__(self, parent, *args)
        self.parent = parent
        self._directory = directory

        self.images = {"Directory": tk.PhotoImage(),
                       "File": tk.PhotoImage()}

        self.selected = None

        self._tree = ttk.Treeview(self, show="tree")
        self._tree.pack(fill="both", expand=True)

        self._tree.bind("<<TreeviewSelect>>", self._select, "+")
        # self._tree.bind("<Double-Button-1>", self._open_event)
        self._tree.bind("<<TreeviewOpen>>", self._open_event, "+")
        self._tree.bind("<<TreeviewClose>>", self._close_event, "+")

        self.refresh()
项目:pkinter    作者:DeflatedPickle    | 项目源码 | 文件源码
def __init__(self, parent, expanded_text="Collapse <<", collapsed_text="Expand >>", *args):
        ttk.Frame.__init__(self, parent, *args)
        self.parent = parent
        self._expanded_text = expanded_text
        self._collapsed_text = collapsed_text

        self.columnconfigure(1, weight=1)

        self._variable = tk.IntVar()
        self._button = ttk.Checkbutton(self, variable=self._variable, command=self._activate, style="TButton")
        self._button.grid(row=0, column=0)

        self._separator = ttk.Separator(self, orient="horizontal")
        self._separator.grid(row=0, column=1, sticky="we")

        self.frame = ttk.Frame(self)

        self._activate()
项目:pkinter    作者:DeflatedPickle    | 项目源码 | 文件源码
def __init__(self, parent, text="", orient="horizontal", text_align="", padding=5, *args):
        ttk.Frame.__init__(self, parent, *args)
        self.parent = parent
        self._text = text
        self._orient = orient
        self._text_align = text_align
        self._padding = padding

        self._separator = ttk.Separator(self, orient=self._orient)
        self._label = ttk.Label(self, text=self._text)

        if self._orient == "horizontal":
            self.grid_columnconfigure(0, weight=1)

            self._separator.grid(row=0, column=0, sticky="we")
            self._label.grid(row=0, column=0, sticky=self._text_align, padx=self._padding)

        elif self._orient == "vertical":
            self.grid_rowconfigure(0, weight=1)

            self._separator.grid(row=0, column=0, sticky="ns")
            self._label.grid(row=0, column=0, sticky=self._text_align, pady=self._padding)

##################################################
项目:python-tagger    作者:Bilingual-Annotation-Task-Force    | 项目源码 | 文件源码
def _create_widgets(self):
        # Gold standard data
        self.gold_path_label = ttk.Label(text="Gold Standard:")
        self.gold_path_entry = ttk.Entry(textvariable=self.gold_path)
        self.gold_path_filebutton = ttk.Button(text="...", command=self.findgoldfile)
        # Training data for language 1
        self.lang1_train_path_label = ttk.Label(text="Language 1 Training Data:")
        self.lang1_train_path_entry = ttk.Entry(textvariable=self.lang1_train_path)
        self.lang1_train_path_filebutton = ttk.Button(text="...", command=self.findlang1trainfile)
        # Training data for language 2
        self.lang2_train_path_label = ttk.Label(text="Language 2 Training Data:")
        self.lang2_train_path_entry = ttk.Entry(textvariable=self.lang2_train_path)
        self.lang2_train_path_filebutton = ttk.Button(text="...", command=self.findlang2trainfile)
        # Examination
        self.examine_button = ttk.Button(text="Examine!", command=self.launch_main)
        # Redirected ouput
        self.output_frame = ttk.Frame()
        self.output = tk.Text(master=self.output_frame)
        self.output_scroll = ttk.Scrollbar(self.output_frame)
        self.output.configure(yscrollcommand=self.output_scroll.set)
        self.output_scroll.configure(command=self.output.yview)

        self.redirected = Redirector(self.output)
项目:synthesizer    作者:irmen    | 项目源码 | 文件源码
def __init__(self, app, master):
        super().__init__(master, text="Playlist", padding=4)
        self.app = app
        bf = ttk.Frame(self)
        ttk.Button(bf, text="Move to Top", width=11, command=self.do_to_top).pack()
        ttk.Button(bf, text="Move Up", width=11, command=self.do_move_up).pack()
        ttk.Button(bf, text="Move Down", width=11, command=self.do_move_down).pack()
        ttk.Button(bf, text="Remove", width=11, command=self.do_remove).pack()
        bf.pack(side=tk.LEFT, padx=4)
        sf = ttk.Frame(self)
        cols = [("title", 300), ("artist", 180), ("album", 180), ("length", 60)]
        self.listTree = ttk.Treeview(sf, columns=[col for col, _ in cols], height=10, show="headings")
        vsb = ttk.Scrollbar(orient="vertical", command=self.listTree.yview)
        self.listTree.configure(yscrollcommand=vsb.set)
        self.listTree.grid(column=1, row=0, sticky=tk.NSEW, in_=sf)
        vsb.grid(column=0, row=0, sticky=tk.NS, in_=sf)
        for col, colwidth in cols:
            self.listTree.heading(col, text=col.title())
            self.listTree.column(col, width=colwidth)
        sf.grid_columnconfigure(0, weight=1)
        sf.grid_rowconfigure(0, weight=1)
        sf.pack(side=tk.LEFT, padx=4)
项目:cpsc415    作者:WheezePuppet    | 项目源码 | 文件源码
def __init__(self, root):
        self.game = chess_model.game
        self.do_replay = False

        # photo_images: the PhotoImage objects, one per *type* of piece, that
        # are loaded from disk.
        self.photo_images = {}

        # displayed_images: the actual individual displayed spites, one per
        # *piece*, that are each positioned on an actual square.
        self.displayed_images = {}

        self.custom_font = tkFont.Font(family="{Times}",size=16)
        self.bigger_font = tkFont.Font(family="{Times}",size=20)
        self.root = root
        self.root.title("Stephen's Crazy Chess")
        self.root.bind('<Return>', self.start_game)
        self.top = ttk.Frame(self.root)
        self.top.pack()
        self.setup()
        self._drag_stuff = {'x': 0, 'y': 0, 'piece': None}
        self.center()
项目:Quiver    作者:DeflatedPickle    | 项目源码 | 文件源码
def __init__(self, parent, **kwargs):
        ttk.Frame.__init__(self, parent, **kwargs)
        self.parent = parent
        self.rowconfigure(0, weight=1)
        self.columnconfigure(0, weight=1)

        self.widget_tree = ttk.Treeview(self, selectmode="browse", columns=[""])
        self.widget_tree.grid(row=0, column=0, sticky="nesw")

        self.widget_tree.configure(selectmode="browse")
        self.widget_tree.heading("#0", text="Mod Name")
        self.widget_tree.heading("#1", text="Mod Extension")
        self.widget_tree.column("#1", width=100, stretch=False)

        self.scrollbar_horizontal = ttk.Scrollbar(self, orient="horizontal", command=self.widget_tree.xview)
        self.scrollbar_horizontal.grid(row=1, column=0, sticky="we")

        self.scrollbar_vertical = ttk.Scrollbar(self, orient="vertical", command=self.widget_tree.yview)
        self.scrollbar_vertical.grid(row=0, column=1, sticky="ns")

        self.widget_tree.configure(xscrollcommand=self.scrollbar_horizontal.set,
                                   yscrollcommand=self.scrollbar_vertical.set)
项目:Quiver    作者:DeflatedPickle    | 项目源码 | 文件源码
def body(self, master):
        TreeDialog.body(self, master)

        frame = ttk.Frame(master)
        frame.pack(side="right")

        frame_one = ttk.Frame(frame)
        frame_one.pack(pady=5)

        add = ttk.Button(frame_one, text="Add Pack")
        add.pack()

        remove = ttk.Button(frame_one, text="Remove Pack")
        remove.pack()

        frame_two = ttk.Frame(frame)
        frame_two.pack(pady=5)

        enable = ttk.Button(frame_two, text="Enable Pack")
        enable.pack()

        disable = ttk.Button(frame_two, text="Disable Pack")
        disable.pack()
项目:pkinter    作者:DeflatedPickle    | 项目源码 | 文件源码
def __init__(self, parent, title="", title_command=None, info="", info_command=None, background="SystemButtonFace", *args):
        ttk.Frame.__init__(self, parent, *args)
        self.parent = parent
        self._title = title
        self._title_command = title_command
        self._info = info
        self._info_command = info_command
        self._background = background

        self.columnconfigure(1, weight=1)

        style = ttk.Style()
        style.configure("InfoBar.Toolbutton", background=self._background)
        style.configure("InfoClose.InfoBar.Toolbutton", anchor="center")

        if self._title != "":
            self._title_button = ttk.Button(self, text=self._title, style="InfoBar.Toolbutton", command=self._title_command)
            self._title_button.grid(row=0, column=0)

        self._info_button = ttk.Button(self, text=self._info, style="InfoBar.Toolbutton", command=self._info_command)
        self._info_button.grid(row=0, column=1, sticky="we")

        self._close_button = ttk.Button(self, text="x", width=2, style="InfoClose.InfoBar.Toolbutton", command=self.close)
        self._close_button.grid(row=0, column=2)
项目:pkinter    作者:DeflatedPickle    | 项目源码 | 文件源码
def __init__(self, parent, on_text="Active", off_text="Inactive", default_state=False, state="enabled", *args):
        ttk.LabelFrame.__init__(self, parent, labelanchor="n", *args)
        self.parent = parent
        self._on_text = on_text
        self._off_text = off_text
        self._default_state = default_state
        self._state = state

        self._fill = tk.Frame(self, height=5)

        self._variable = tk.IntVar()
        self._variable.set(default_state)

        self._button = ttk.Checkbutton(self, width=11, state=self._state, variable=self._variable, command=self._activate, style="TButton")
        self.configure(labelwidget=self._button)

        self.frame = ttk.Frame(self)

        self._activate()
项目:skan    作者:jni    | 项目源码 | 文件源码
def create_parameters_frame(self, parent):
        parameters = ttk.Frame(master=parent, padding=STANDARD_MARGIN)
        parameters.grid(sticky='nsew')

        heading = ttk.Label(parameters, text='Analysis parameters')
        heading.grid(column=0, row=0, sticky='n')

        for i, param in enumerate(self.parameters, start=1):
            param_label = ttk.Label(parameters, text=param._name)
            param_label.grid(row=i, column=0, sticky='nsew')
            if type(param) == tk.BooleanVar:
                param_entry = ttk.Checkbutton(parameters, variable=param)
            elif hasattr(param, '_choices'):
                param_entry = ttk.OptionMenu(parameters, param, param.get(),
                                             *param._choices.keys())
            else:
                param_entry = ttk.Entry(parameters, textvariable=param)
            param_entry.grid(row=i, column=1, sticky='nsew')
项目:tk_tools    作者:slightlynybbled    | 项目源码 | 文件源码
def __place_widgets(self):
        # header frame and its widgets
        hframe = tkinter.ttk.Frame(self)
        lbtn = tkinter.ttk.Button(hframe,
                                  style='L.TButton',
                                  command=self._prev_month)
        rbtn = tkinter.ttk.Button(hframe,
                                  style='R.TButton',
                                  command=self._next_month)
        self._header = tkinter.ttk.Label(hframe, width=15, anchor='center')
        # the calendar
        self._calendar = tkinter.ttk.Treeview(self, show='',
                                              selectmode='none', height=7)

        # pack the widgets
        hframe.pack(in_=self, side='top', pady=4, anchor='center')
        lbtn.grid(in_=hframe)
        self._header.grid(in_=hframe, column=1, row=0, padx=12)
        rbtn.grid(in_=hframe, column=2, row=0)
        self._calendar.pack(in_=self, expand=1, fill='both', side='bottom')
项目:Colony    作者:DeflatedPickle    | 项目源码 | 文件源码
def __init__(self, parent, game, **kwargs):
        ttk.Frame.__init__(self, parent, **kwargs)
        self.parent = parent
        self.game = game

        self.add_button("Construction")

        self.menu_colonists = menus.MenuColonists(self)
        self.add_button("Colonists", self.menu_colonists)

        self.add_button("Animals")
        self.add_button("Wildlife")

        self.menu_relationships = menus.MenuRelationships(self)
        self.add_button("Relationships", self.menu_relationships)

        if self.parent.variable_debug.get():
            self.menu_debug = menus.MenuDebug(self)
            self.add_button("Debug", self.menu_debug)

        self.option_menu = menus.MenuOptions(self)
        self.add_button("Menu", self.option_menu)
项目:Colony    作者:DeflatedPickle    | 项目源码 | 文件源码
def __init__(self, parent, *args, **kwargs):
        tk.Toplevel.__init__(self, parent, *args, **kwargs)
        self.parent = parent
        self.resizable(False, False)
        self.geometry("200x250")
        self.transient(parent)
        self.grab_set()

        self.current_row = 0

        self.frame_widget = ttk.Frame(self)
        self.frame_widget.pack(fill="both", expand=True)
        self.frame_widget.rowconfigure(0, weight=1)
        self.frame_widget.columnconfigure(0, weight=1)

        self.frame_buttons = ttk.Frame(self)
        self.frame_buttons.pack(fill="x")
        ttk.Button(self.frame_buttons, text="Close", command=self.close).pack(side="left")

        self.parent.bind("<Configure>", self.center)
        self.protocol("WM_DELETE_WINDOW", self.close)

        self.center()
项目:schick-data-gui    作者:tuxor1337    | 项目源码 | 文件源码
def __init__(self, master, schick_reader):
        ttk.Frame.__init__(self, master)

        self.schick_reader = schick_reader
        self.index = self.schick_reader.vars

        self.v_name = StringVar()
        self.v_type = StringVar()

        lbl = ttk.Label(self, textvariable=self.v_name, font="bold")
        lbl2 = ttk.Label(self, textvariable=self.v_type)
        self.v_comment = Text(self, height=5, width=100)
        self.v_hex = Text(self, height=20, width=63, padx=10, pady=10)

        lbl.grid(column=0, row=0, padx=10, pady=5, sticky=(N,W))
        lbl2.grid(column=0, row=1, padx=10, pady=5, sticky=(N,W))
        self.v_comment.grid(column=0, row=2, padx=10, pady=5, sticky=(N,W))
        self.v_hex.grid(column=0, row=3, padx=10, pady=5, sticky=(N,S))
        self.grid_columnconfigure(0, weight=1)
        self.grid_rowconfigure(3, weight=1)

        self.v_name.set('')
        self.v_type.set('')
项目:schick-data-gui    作者:tuxor1337    | 项目源码 | 文件源码
def __init__(self, master, schick_reader):
        ttk.Frame.__init__(self, master)

        self.schick_reader = schick_reader
        self.index = ["Routes", "Travel events"]

        self.contents = {
            "Routes": SchickXRoutesContent(self, self.schick_reader),
            "Travel events": SchickXTEventsContent(self, self.schick_reader)
        }

        self.v_name = StringVar()
        self.content = None

        lbl = ttk.Label(self, textvariable=self.v_name, font="bold")

        lbl.grid(column=0, row=0, padx=10, pady=5, sticky=(N,W))
        self.grid_columnconfigure(0, weight=1)
        self.grid_rowconfigure(1, weight=1)

        self.v_name.set('')
项目:schick-data-gui    作者:tuxor1337    | 项目源码 | 文件源码
def __init__(self, master, schick_reader, fname, page=0):
        ttk.Frame.__init__(self, master)

        self.page = page
        self.schick_reader = schick_reader

        self.canvas = Canvas(self, height=8*16*1.5)
        self.lbox = FilteredListbox(self, listvariable=[], height=15)

        self.canvas.grid(row=0, column=0, pady=5, sticky=(N,E,S,W))
        self.lbox.grid(row=1, column=0, sticky=(N,E,S,W))
        self.grid_rowconfigure(1, weight=1)
        self.grid_columnconfigure(0, weight=1)

        self.canvas.bind("<Configure>", self.on_resize)
        self.lbox.bind("<<ListboxSelect>>", self.select_loc_cb)

        self.images, self.loctab = self.schick_reader.read_archive_map_file(fname)
        for img in self.images: img["bak"] = img["rgb"].copy()
        self.max_pages = len(self.images)
        self.filter_loctab(self.page)
        self.show_image(self.page)
项目:schick-data-gui    作者:tuxor1337    | 项目源码 | 文件源码
def __init__(self, master, schick_reader, fname, page=0):
        ttk.Frame.__init__(self, master)

        self.schick_reader = schick_reader

        self.canvas = Canvas(self)
        s = Scrollbar(self)
        self.canvas.config(yscrollcommand=s.set)
        s.config(command=self.canvas.yview)

        s.grid(row=0, column=1, sticky=(N,S))
        self.canvas.grid(row=0, column=0, sticky=(N,E,S,W))
        self.grid_rowconfigure(0, weight=1)
        self.grid_columnconfigure(0, weight=1)

        self.canvas.bind("<Configure>", self.on_resize)

        self.images, self.max_pages = self.schick_reader.read_archive_nvf_file(fname, page)
        self.show_images()
项目:BioDataSorter    作者:BioDataSorter    | 项目源码 | 文件源码
def __init__(self, parent, controller, *args, **kwargs):
        super().__init__(parent)
        Frame.__init__(self, parent, *args, **kwargs)
        self.controller = controller

        info_image = ".\images\Information.png"
        self.b1, self.photo = self.button_from_label("Info",
                                                     info_image,
                                                     self.info_button,
                                                     "Get information and help"
                                                     " about new features")
        self.b1.grid(row=0, padx=(20, 0), pady=15)

        self.b2, self.photo2 = self.button_from_label("New",
                                                      ".\images\Search.png",
                                                      self.new_button,
                                                      "Process another input "
                                                      "file to get citations.")
        self.b2.grid(row=1, padx=(20, 0), pady=15)
项目:porcupine    作者:Akuli    | 项目源码 | 文件源码
def make_please_wait_window(self):
        window = self.please_wait_window = tkinter.Toplevel()
        window.transient(porcupine.get_main_window())
        window.title("Pasting...")
        window.geometry('350x150')
        window.resizable(False, False)

        # disable the close button, there's no good way to cancel this
        # forcefully :(
        window.protocol('WM_DELETE_WINDOW', (lambda: None))

        content = ttk.Frame(window)
        content.pack(fill='both', expand=True)

        label = ttk.Label(
            content, font=('', 12, ''),
            text=("Pasting to %s, please wait..." % self.pastebin_name))
        label.pack(expand=True)

        progressbar = ttk.Progressbar(content, mode='indeterminate')
        progressbar.pack(fill='x', padx=15, pady=15)
        progressbar.start()
项目:PyTouch    作者:mNisblee    | 项目源码 | 文件源码
def __init__(self, master, **kwargs):
        super().__init__(master, **kwargs)

        self.content_frame = ttk.Frame(self)
        self.lb_title = ttk.Label(self.content_frame, text='Lesson paused')
        self.button_frame = ttk.Frame(self.content_frame)
        self.bt_continue = ttk.Button(self.button_frame, text='Continue', default='active', command=self.on_continue)
        self.bt_restart = ttk.Button(self.button_frame, text='Restart')
        self.bt_abort = ttk.Button(self.button_frame, text='Abort')

        self.content_frame.grid(column=0, row=0)
        self.lb_title.grid(column=0, row=0, pady=3)
        self.button_frame.grid(column=0, row=1, pady=10)
        self.bt_continue.grid(column=0, row=1, pady=3)
        self.bt_restart.grid(column=0, row=2, pady=3)
        self.bt_abort.grid(column=0, row=3, pady=3)

        self.columnconfigure(0, weight=1)
        self.rowconfigure(0, weight=1)

        self.focus_set()
项目:LadderiLogical    作者:mikadam    | 项目源码 | 文件源码
def __init__(self,root,app):
        ttk.Frame.__init__(self, root)
        self.root=root
        self.app=app

        self.tool="select"

        self.select=ttk.Button(master=self,text="Select",command=lambda:self.change_tool("select"))
        self.horizontal=ttk.Button(master=self,text="Horizontal",command=lambda:self.change_tool("horizontal"))
        self.hswitch=ttk.Button(master=self,text="HSwitch",command=lambda:self.change_tool("hswitch"))
        self.delete=ttk.Button(master=self,text="Delete",command=lambda:self.change_tool("delete"))
        self.flag=ttk.Button(master=self,text="Flag",command=lambda:self.change_tool("flag"))
        self.auto=ttk.Button(master=self,text="Auto",command=lambda:self.change_tool("auto"))


        self.select.grid(row=0,column=0)
        self.auto.grid(row=0,column=1)
        self.delete.grid(row=0,column=2)
        self.horizontal.grid(row=0,column=3)
        self.hswitch.grid(row=0,column=4)
        self.flag.grid(row=0,column=5)
项目:synthesizer    作者:irmen    | 项目源码 | 文件源码
def __init__(self, app, master):
        super().__init__(master, text="Effects/Samples - shift+click to assign sample", padding=4)
        self.app = app
        self.effects = {num: None for num in range(16)}
        f = ttk.Frame(self)
        self.buttons = []
        for i in range(1, 9):
            b = ttk.Button(f, text="# {:d}".format(i), width=14, state=tk.DISABLED)
            b.bind("<ButtonRelease>", self.do_button_release)
            b.effect_nr = i
            b.pack(side=tk.LEFT)
            self.buttons.append(b)
        f.pack()
        f = ttk.Frame(self)
        for i in range(9, 17):
            b = ttk.Button(f, text="# {:d}".format(i), width=14, state=tk.DISABLED)
            b.bind("<ButtonRelease>", self.do_button_release)
            b.effect_nr = i
            b. pack(side=tk.LEFT)
            self.buttons.append(b)
        f.pack()
        self.after(2000, lambda: Pyro4.Future(self.load_settings)(True))
项目:PyTasks    作者:TheHirschfield    | 项目源码 | 文件源码
def __init__(self, parent):
        Frame.__init__(self, parent)

        #Get Current Calender States
        firstDay = calendar.MONDAY
        year = self.datetime.now().year
        month = self.datetime.now().month
        selectedBg = '#9bc0d9' # Previous - 84b5d3
        selectedFg = '#ffffff'

        self.date = self.datetime(year,month,1)
        self.selected = None
        self.currentTime = ""


        self.cal = getCalendar(None,firstDay)

        self.parent = parent
        self.initUI()

        #Main Calender Widget
        self.calenderStyleWidget()
        self.calenderPlaceWidget()
        self.calenderConfig()

        self.setupSelected(selectedBg, selectedFg)

        self.items = [self.calenderMainView.insert('', 'end', values='') for _ in range(6)]

        self.calenderMake()
        self.calenderMainView.bind('<Map>',self.minsize)

        #Add Events Listing Tabs
        self.eventViewerPlace()

    #Main Window Creation
项目:PyTasks    作者:TheHirschfield    | 项目源码 | 文件源码
def calenderPlaceWidget(self):
        #Header Frame
        calenderFrame = ttk.Frame(self)
        leftMonthChangeButton = ttk.Button(calenderFrame, style='L.TButton', command=self.setPreviousMonth)
        rightMonthChangeButton = ttk.Button(calenderFrame, style='R.TButton', command=self.setNextMonth)
        self.calenderHeader = ttk.Label(calenderFrame, width=15, anchor='center')
        self.calenderMainView = ttk.Treeview(show='', selectmode='none', height=7, style='Calendar.Treeview')

        #Pack Header
        calenderFrame.pack(in_=self, side='top', pady=4, anchor='center')
        leftMonthChangeButton.grid(in_=calenderFrame)
        self.calenderHeader.grid(in_=calenderFrame, column=1, row=0, padx=12)
        rightMonthChangeButton.grid(in_=calenderFrame, column=2, row=0)
        self.calenderMainView.pack(in_=self, fill='x', side='top')
项目:PyTasks    作者:TheHirschfield    | 项目源码 | 文件源码
def eventViewerPlace(self):
        eventViewerFrame = ttk.Frame(self)               
        eventViewerFrame.pack(in_=self, side='top',fill='both', expand='Y')

        self.eventMainView = ttk.Notebook(eventViewerFrame, name='notebook')

        #Event Tab Text Box - Tab 0
        tab0 = ttk.Frame(self.eventMainView)
        self.eventMainView.add(tab0, text="Tasks")

        self.eventMainView.pack(fill='both', expand=Y, side='top')

        self.eventsBox = Text(tab0, wrap=WORD, width=40, height=10)
        self.eventsBox.pack(fill=BOTH, expand=Y)

        #self.eventsBox.config(state=DISABLED)


        #Note Tab Text Box - Tab 1
        tab1 = ttk.Frame(self.eventMainView)
        self.eventMainView.add(tab1, text="Notes")

        self.eventMainView.pack(fill='both', expand=Y, side='top')

        self.notesBox = Text(tab1, wrap=WORD, width=40, height=10)
        vscroll = ttk.Scrollbar(tab1, orient=VERTICAL, command=self.notesBox.yview)
        self.notesBox['yscroll'] = vscroll.set
        vscroll.pack(side=RIGHT, fill=Y)
        self.notesBox.pack(fill=BOTH, expand=Y)
项目:modis    作者:Infraxion    | 项目源码 | 文件源码
def __init__(self, parent):
        super(Frame, self).__init__(parent)

        logger.debug("Initialising frame")
项目:modis    作者:Infraxion    | 项目源码 | 文件源码
def __init__(self, parent):
        """Send messages from the bot

        Args:
            parent:
        """

        super(ChatFrame, self).__init__(parent, padding=8, text="Chat")

        self.channel = tk.StringVar()
        self.message = tk.StringVar()

        self.channel_frame = ttk.Frame(self)
        self.channel_frame.grid(column=0, row=0, sticky="W E")
        self.channel_label = ttk.Label(self.channel_frame, text="Channel ID:")
        self.channel_label.grid(column=0, row=0, sticky="W E")
        self.channel_box = ttk.Entry(self.channel_frame, textvariable=self.channel)
        self.channel_box.grid(column=0, row=1, sticky="W E")
        self.channel_frame.columnconfigure(0, weight=1)

        self.message_frame = ttk.Frame(self)
        self.message_frame.grid(column=0, row=1, pady=8, sticky="W E")
        self.message_label = ttk.Label(self.message_frame, text="Message:")
        self.message_label.grid(column=0, row=0, sticky="W E")
        self.message_box = ttk.Entry(self.message_frame, textvariable=self.message)
        self.message_box.grid(column=0, row=1, sticky="W E")
        self.message_frame.columnconfigure(0, weight=1)

        self.send_button = ttk.Button(self, command=lambda: self.add_current_message(), text="Send")
        self.send_button.grid(column=0, row=2, sticky="W")

        self.columnconfigure(0, weight=1)
项目:modis    作者:Infraxion    | 项目源码 | 文件源码
def __init__(self, parent):
        """
        Create a new UI for the module

        Args:
            parent: A tk or ttk object
        """

        super(ModuleUIFrame, self).__init__(parent)
        self.columnconfigure(0, weight=1)
        self.rowconfigure(1, weight=1)

        # Set default values
        from ....datatools import get_data
        data = get_data()

        # API Frame
        api_frame = ttk.LabelFrame(self, padding=8, text="Google API")
        api_frame.grid(row=0, column=0, sticky="W E N S")
        api_frame.columnconfigure(0, weight=1)
        # Add key fields
        self.google_api_key = tk.StringVar()
        ttk.Label(api_frame, text="Google API Key").grid(column=0, row=0, sticky="W E N S")
        ttk.Entry(api_frame, textvariable=self.google_api_key).grid(
            column=0, row=1, padx=0, pady=4, sticky="W E N S")
        self.soundcloud_client_id = tk.StringVar()
        ttk.Label(api_frame, text="SoundCloud Client ID").grid(column=0, row=2, sticky="W E N S")
        ttk.Entry(api_frame, textvariable=self.soundcloud_client_id).grid(
            column=0, row=3, padx=0, pady=4, sticky="W E N S")
        ttk.Button(api_frame, command=lambda: self.update_keys(), text="Update API Data").grid(
            column=0, row=4, padx=0, pady=4, sticky="W E N S")

        if "google_api_key" in data["discord"]["keys"]:
            self.google_api_key.set(data["discord"]["keys"]["google_api_key"])
        if "soundcloud_client_id" in data["discord"]["keys"]:
            self.soundcloud_client_id.set(data["discord"]["keys"]["soundcloud_client_id"])
项目:modis    作者:Infraxion    | 项目源码 | 文件源码
def __init__(self, parent):
        super(Frame, self).__init__(parent)

        logger.debug("Initialising frame")
项目:cpsc415    作者:WheezePuppet    | 项目源码 | 文件源码
def create_top_frame(self):
        self.status_bar = tk.Frame(self.top)
        self.status_bar.pack(padx=10,pady=10)
        ttk.Label(self.status_bar, text="Turn: ",
            font=self.custom_font).pack(side="left")
        self.turn_label = ttk.Label(self.status_bar,
            text=self.game.player_turn.capitalize(), width=5,
            font=self.custom_font)
        self.turn_label.pack(side="left")
        self.status_label = ttk.Label(self.status_bar, text='',
            foreground='red', anchor=tk.CENTER, width=40,
            font=self.custom_font)
        self.status_label.pack(side="right")
        self.content = ttk.Frame(self.top)
        self.content.pack()
项目:Python-GUI-Programming-Cookbook-Second-Edition    作者:PacktPublishing    | 项目源码 | 文件源码
def display_tab2():
    monty2 = ttk.LabelFrame(display_area, text=' Holy Grail ')
    monty2.grid(column=0, row=0, padx=8, pady=4)

    # Creating three checkbuttons
    chVarDis = tk.IntVar()
    check1 = tk.Checkbutton(monty2, text="Disabled", variable=chVarDis, state='disabled')
    check1.select()
    check1.grid(column=0, row=0, sticky=tk.W)                 

    chVarUn = tk.IntVar()
    check2 = tk.Checkbutton(monty2, text="UnChecked", variable=chVarUn)
    check2.deselect()
    check2.grid(column=1, row=0, sticky=tk.W )                  

    chVarEn = tk.IntVar()
    check3 = tk.Checkbutton(monty2, text="Toggle", variable=chVarEn)
    check3.deselect()
    check3.grid(column=2, row=0, sticky=tk.W)                 

    # Create a container to hold labels
    labelsFrame = ttk.LabelFrame(monty2, text=' Labels in a Frame ')
    labelsFrame.grid(column=0, row=7)

    # Place labels into the container element - vertically
    ttk.Label(labelsFrame, text="Label1").grid(column=0, row=0)
    ttk.Label(labelsFrame, text="Label2").grid(column=0, row=1)

    # Add some space around each label
    for child in labelsFrame.winfo_children(): 
        child.grid_configure(padx=8)

#------------------------------------------
项目:Quiver    作者:DeflatedPickle    | 项目源码 | 文件源码
def __init__(self, parent, *args, **kwargs):
        ttk.Frame.__init__(self, parent, *args, **kwargs)
        self.parent = parent
        self.columnconfigure(6, weight=1)

        # self.widget_button_undo = ttk.Button(self, text="Undo", style="Toolbutton")
        # self.widget_button_undo.grid(row=0, column=0)

        # self.widget_button_redo = ttk.Button(self, text="Redo", style="Toolbutton")
        # self.widget_button_redo.grid(row=0, column=1)

        # ttk.Separator(self, orient="vertical").grid(row=0, column=2, sticky="ns")

        self.widget_button_refresh = ttk.Button(self, text="Refresh", image=self.parent.image_refresh,
                                                command=self.parent.cmd.tree_refresh,
                                                style="Toolbutton")
        self.widget_button_refresh.grid(row=0, column=3)
        idlelib.ToolTip.ToolTip(self.widget_button_refresh, "Refresh the files in the TreeView")

        self.widget_entry_search = ttk.Entry(self)
        self.widget_entry_search.grid(row=0, column=6, sticky="we")

        # self.widget_button_previous = ttk.Button(self, text="Previous", state="disabled")
        # self.widget_button_previous.grid(row=0, column=7)
        #
        # self.widget_button_next = ttk.Button(self, text="Next", state="disabled")
        # self.widget_button_next.grid(row=0, column=8)

        self.widget_button_search = ttk.Button(self, text="Search", command=self.parent.cmd.search)
        self.widget_button_search.grid(row=0, column=9)
        idlelib.ToolTip.ToolTip(self.widget_button_search, "Search the TreeView for a file")

        self.widget_button_exit = ttk.Button(self, text="Exit", image=self.parent.image_exit,
                                             command=sys.exit,
                                             style="Toolbutton")
        self.widget_button_exit.grid(row=0, column=10, sticky="e")
        idlelib.ToolTip.ToolTip(self.widget_button_exit, "Exit the program")
项目:Quiver    作者:DeflatedPickle    | 项目源码 | 文件源码
def main():
    app = tk.Tk()
    app.widget_frame_buttons = ttk.Frame(app)
    app.widget_frame_buttons.pack(side="bottom", fill="x")

    ModDetector(app)
    app.mainloop()
项目:Quiver    作者:DeflatedPickle    | 项目源码 | 文件源码
def buttonbox(self):
        box = ttk.Frame(self)

        ok = ttk.Button(box, text="OK", width=10, command=self.ok, default="active")
        ok.pack(side="left", padx=5, pady=5)

        cancel = ttk.Button(box, text="Cancel", width=10, command=self.cancel)
        cancel.pack(side="left", padx=5, pady=5)

        self.bind("<Return>", self.ok)
        self.bind("<Escape>", self.cancel)

        box.pack()
项目:Quiver    作者:DeflatedPickle    | 项目源码 | 文件源码
def __init__(self, parent, *args, **kwargs):
        ttk.Frame.__init__(self, parent, *args, **kwargs)
        self.parent = parent

        self.is_text_valid = False
        self.search_entry = SearchEntry(self, replace=True)
        self.search_entry.pack(side="left")

        ttk.Separator(self, orient="vertical").pack(side="left", fill="y", padx=3, pady=1)

        self.button_replace = ttk.Button(self, text="Replace", command=self.parent.master.replace)
        self.button_replace.pack(side="left")

        self.button_replace_all = ttk.Button(self, text="Replace All", command=self.parent.master.replace_all)
        self.button_replace_all.pack(side="left")
项目:Quiver    作者:DeflatedPickle    | 项目源码 | 文件源码
def __init__(self, parent, replace=False, *args, **kwargs):
        ttk.Frame.__init__(self, parent, *args, **kwargs)
        self.parent = parent
        self.replace = replace

        self.columnconfigure(1, weight=1)

        if not self.replace:
            self.variable_search = tk.BooleanVar()
            self.variable_search.trace("w", self.check_search)

            self.button_search = ttk.Button(self, text="Search", image=self.parent.parent.master.image_find,
                                            command=lambda: self.parent.parent.master.search(
                                                match_case=not self.parent.parent.master.findbar.variable_match_case.get(),
                                                exact=not self.parent.parent.master.findbar.variable_exact.get(),
                                                regular_expression=not self.parent.parent.master.findbar.variable_regular_expression.get()))
            self.button_search.grid(row=0, column=0)

            self.variable_entry = tk.StringVar()
            self.variable_entry.trace("w", self.check_entry)

        self.entry = ttk.Entry(self, textvariable=self.variable_entry if not self.replace else None)
        self.entry.grid(row=0, column=1)

        self.button_clear = ttk.Button(self, text="Clear", image=self.parent.parent.master.image_exit,
                                       command=self.clear)

        if not self.replace:
            self.check_entry()
项目:Craft-Clash    作者:Derpyface-Development-Co    | 项目源码 | 文件源码
def create(self, **kwargs):
        return ttk.Frame(self.root, **kwargs)
项目:Craft-Clash    作者:Derpyface-Development-Co    | 项目源码 | 文件源码
def create(self, **kwargs):
        return ttk.Frame(self.root, **kwargs)
项目:pkinter    作者:DeflatedPickle    | 项目源码 | 文件源码
def __init__(self, parent, directory="", *args):
        ttk.Frame.__init__(self, parent, *args)
        self.parent = parent
        self._directory = directory

        self._variable = tk.StringVar()

        self._entry = ttk.Entry(self, textvariable=self._variable)
        self._entry.pack(side="left", fill="x", expand=True)

        self._button = ttk.Button(self, text="Browse", command=self._browse)
        self._button.pack(side="right")
项目:pkinter    作者:DeflatedPickle    | 项目源码 | 文件源码
def __init__(self, parent, label_text="", accelerator_text="", has_separator=False, *args):
        ttk.Frame.__init__(self, parent, *args)
        self.parent = parent

        self._label_text = label_text
        self._accelerator_text = accelerator_text
        self._has_separator = has_separator

        self._label = ttk.Label(self, text=self._label_text).pack(side="left", fill="x")
        self._accelerator = ttk.Label(self, text=self._accelerator_text).pack(side="right")

        if self._has_separator:
            self._separator = ttk.Separator(self, orient="vertical").pack(side="right", fill="y")

##################################################
项目:pkinter    作者:DeflatedPickle    | 项目源码 | 文件源码
def __init__(self, bordercolour="dark grey", borderspan=5, *args):
        tk.Tk.__init__(self, *args)
        self.bordercolour = bordercolour
        self.borderspan = borderspan
        self.overrideredirect(True)
        self.rowconfigure(1, weight=1)
        self.columnconfigure(1, weight=1)

        ttk.Style().configure("Border.TFrame", background=self.bordercolour)

        self.nwf = ttk.Frame(self, width=self.borderspan, height=self.borderspan, style="Border.TFrame")
        self.nwf.grid(row=0, column=0, sticky="nesw")
        self.nf = ttk.Frame(self, height=self.borderspan, style="Border.TFrame")
        self.nf.grid(row=0, column=1, sticky="nesw")
        self.nef = ttk.Frame(self, width=self.borderspan, height=self.borderspan, style="Border.TFrame")
        self.nef.grid(row=0, column=2, sticky="nesw")

        self.wf = ttk.Frame(self, width=self.borderspan, style="Border.TFrame")
        self.wf.grid(row=1, column=0, sticky="nesw")

        self.inf = ttk.Frame(self)
        self.inf.grid(row=1, column=1, sticky="nesw")

        self.ef = ttk.Frame(self, width=self.borderspan, style="Border.TFrame")
        self.ef.grid(row=1, column=2, sticky="nesw")

        self.swf = ttk.Frame(self, width=self.borderspan, height=self.borderspan, style="Border.TFrame")
        self.swf.grid(row=2, column=0, sticky="nesw")
        self.sf = ttk.Frame(self, height=self.borderspan, style="Border.TFrame")
        self.sf.grid(row=2, column=1, sticky="nesw")
        self.sef = ttk.Frame(self, width=self.borderspan, height=self.borderspan, style="Border.TFrame")
        self.sef.grid(row=2, column=2, sticky="nesw")

##################################################
项目:pkinter    作者:DeflatedPickle    | 项目源码 | 文件源码
def __init__(self, parent, title, image, message, life, height, ipad, *args):
        ttk.Frame.__init__(self, parent, height=height, style="Popup.TFrame", *args)
        self.parent = parent
        self._title = title
        self._image = image
        self._life = life
        self._message = message
        self._ipad = ipad

        self.grid_propagate(False)
        self.rowconfigure(1, weight=1)
        self.columnconfigure(1, weight=1)

        image = ttk.Label(self, image=self._image, style="Image.Popup.TLabel")
        image.grid(row=0, column=0, rowspan=2, sticky="nesw", padx=self._ipad, pady=self._ipad)

        title_frame = ttk.Frame(self)
        title_frame.grid(row=0, column=1, sticky="we", padx=self._ipad, pady=self._ipad)

        label = ttk.Label(title_frame, text=self._title, style="Title.Popup.TLabel")
        label.pack(side="left", fill="both", expand=True)

        close = ttk.Button(title_frame, text="X", width=3, command=self.remove, style="Close.Popup.TButton")
        close.pack(side="right")

        message = ttk.Label(self, text=self._message, style="Message.Popup.TLabel")
        message.grid(row=1, column=1, sticky="nw", padx=self._ipad, pady=self._ipad)

        if self._life > 0:
            self.after(self._life, self.remove)
项目:pkinter    作者:DeflatedPickle    | 项目源码 | 文件源码
def __init__(self, parent, filetypes=(("All Files", "*.*"), ("", "")), directory="", *args):
        ttk.Frame.__init__(self, parent, *args)
        self.parent = parent
        self._filetypes = filetypes
        self._directory = directory

        self._variable = tk.StringVar()

        self._entry = ttk.Entry(self, textvariable=self._variable)
        self._entry.pack(side="left", fill="x", expand=True)

        self._button = ttk.Button(self, text="Browse", command=self._browse)
        self._button.pack(side="right")
项目:pkinter    作者:DeflatedPickle    | 项目源码 | 文件源码
def __init__(self, parent, *args):
        ttk.Frame.__init__(self, parent, *args)
        self.parent = parent

##################################################
项目:pkinter    作者:DeflatedPickle    | 项目源码 | 文件源码
def __init__(self, parent, *args):
        ttk.Frame.__init__(self, parent, *args)
        self.parent = parent
项目:pkinter    作者:DeflatedPickle    | 项目源码 | 文件源码
def __init__(self, parent, *args):
        ttk.Frame.__init__(self, parent, *args)
        self.parent = parent

        self.columnconfigure((0, 1), weight=1)

        self._button_variable = tk.BooleanVar()
        self._button_variable.set(False)

        self._label_variable = tk.BooleanVar()
        self._label_variable.set(True)

        self._label_text_variable = tk.StringVar()

        ttk.Style().configure("Switch.TLabel", background="white", foreground="light gray", anchor="center")
        ttk.Style().configure("Label.TLabel", background="light blue", foreground="white", anchor="center")

        self._button = ttk.Label(self, text="| | |", width=4, style="Switch.TLabel")
        self._button.bind("<Button-1>", self.switch, "+")

        self._label = ttk.Label(self, textvariable=self._label_text_variable, width=4, style="Label.TLabel")

        ttk.Style().configure("ButtonSwitch.TFrame", background="light blue")
        self.configure(style="ButtonSwitch.TFrame")

        self.switch()
项目:pkinter    作者:DeflatedPickle    | 项目源码 | 文件源码
def __init__(self, parent, *args):
        ttk.Frame.__init__(self, parent, *args)
        self.parent = parent
项目:pkinter    作者:DeflatedPickle    | 项目源码 | 文件源码
def __init__(self, parent, back_text="< Back", next_text="Next >", *args):
        ttk.Frame.__init__(self, parent, *args)
        self.parent = parent
        self._back_text = back_text
        self._next_text = next_text

        self._total_pages = 0
        self._frame_list = []

        self._index = tk.IntVar()
        self._index.set(0)

        self._page = tk.StringVar()
        self._page.set("0 / 0")

        self.frame = ttk.Frame(self)
        self.frame.pack(side="top", fill="both", expand=True)

        self._navigation_frame = ttk.Frame(self)
        self._navigation_frame.pack(side="bottom", fill="x")
        self._navigation_frame.columnconfigure(1, weight=1)

        self._back = ttk.Button(self._navigation_frame, text=back_text, command=self._back)
        self._back.grid(row=0, column=0)

        self._label = ttk.Label(self._navigation_frame, textvariable=self._page)
        self._label.grid(row=0, column=1)

        self._next = ttk.Button(self._navigation_frame, text=next_text, command=self._next)
        self._next.grid(row=0, column=2)