本文整理汇总了Python中tkinter.ttk.Frame.pack_propagate方法的典型用法代码示例。如果您正苦于以下问题:Python Frame.pack_propagate方法的具体用法?Python Frame.pack_propagate怎么用?Python Frame.pack_propagate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.ttk.Frame
的用法示例。
在下文中一共展示了Frame.pack_propagate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initUI
# 需要导入模块: from tkinter.ttk import Frame [as 别名]
# 或者: from tkinter.ttk.Frame import pack_propagate [as 别名]
def initUI(self):
self.parent.title("Digital Cookbook")
self.style = Style()
self.style.theme_use("default")
self.pack(fill=BOTH, expand=1, side=BOTTOM)
# Establish menu bar #
menubar = Menu(self.parent)
self.parent.config(menu=menubar)
# Add file menu #
filemenu = Menu(menubar, tearoff=0)
menubar.add_cascade(label="File", menu=filemenu)
filemenu.add_command(label="Import recipe from XML file", command=self.xmlImport)
filemenu.add_command(label="Add blank recipe to database", command=self.recipeAdd)
filemenu.add_command(label="Delete recipe from database", command=self.recipeDelete)
filemenu.add_command(label="Load recipe", command=self.recipeLoad)
filemenu.add_command(label="Save recipe to database", command=self.recipeSave, accelerator="Ctrl+S")
filemenu.add_separator()
filemenu.add_command(label="Exit", command=self.onExit, accelerator="Ctrl+W")
# Add help menu #
helpmenu = Menu(menubar, tearoff=0)
menubar.add_cascade(label="Help", menu=helpmenu)
helpmenu.add_command(label="About...", command=self.helpAbout)
# Establish toolbar #
frameToolbar = Frame(self.parent) # , relief=RAISED, borderwidth=1)
frameToolbar.pack(side=TOP, fill=X)
# Add buttons to toolbar #
buffer = 2
buttonspaceing = 100
buttonwidth = 12
buttonheight = 30
bImportXML = Button(frameToolbar, text="Import XML", command=self.xmlImport, width=buttonwidth)
bImportXML.pack(side=LEFT, padx=buffer, pady=buffer)
bAddRecipe = Button(frameToolbar, text="Add Recipe", command=self.recipeAdd, width=buttonwidth)
bAddRecipe.pack(side=LEFT, padx=buffer, pady=buffer)
bDeleteRecipe = Button(frameToolbar, text="Delete Recipe", command=self.recipeDelete, width=buttonwidth)
bDeleteRecipe.pack(side=LEFT, padx=buffer, pady=buffer)
bEditRecipe = Button(frameToolbar, text="Load Recipe", command=self.recipeLoad, width=buttonwidth)
bEditRecipe.pack(side=LEFT, padx=buffer, pady=buffer)
bSaveRecipe = Button(frameToolbar, text="Save Recipe", command=self.recipeSave, width=buttonwidth)
bSaveRecipe.pack(side=LEFT, padx=buffer, pady=buffer)
# Recipe list section
frameRecipeList = Frame(self, borderwidth=1, width=200)
frameRecipeList.pack_propagate(0)
frameRecipeList.pack(side=LEFT, fill=Y)
Label(frameRecipeList, text="Recipe List").pack()
# Category option menu
default = StringVar(frameRecipeList)
default.set("----")
recipeCatagories = OptionMenu(frameRecipeList, default, "----", "None", "Cat 1", "Cat 2", "Cat 3")
recipeCatagories.pack(side=TOP, fill=X)
# Filter Frame
frameFilter = Frame(frameRecipeList, relief=RAISED, borderwidth=1, width=200)
frameFilter.pack(side=TOP, fill=X)
Label(frameFilter, text="Filter...").pack()
# Filter text
filterText = Entry(frameFilter)
filterText.pack_propagate(0)
filterText.pack(side=LEFT, fill=X)
# Filter Button
filterButton = Button(frameFilter, text="Go", command=self.placeholder)
filterButton.pack_propagate(0)
filterButton.pack(side=RIGHT)
# Recipe Box Frame
frameRecipeBox = Frame(frameRecipeList, relief=RAISED, borderwidth=1)
frameRecipeBox.pack(side=TOP, fill=BOTH, expand=1)
# ==== Recipe List box ====
recipeListScroll = Scrollbar(frameRecipeBox, orient=VERTICAL)
self.recipeList = Listbox(frameRecipeBox, selectmode=EXTENDED, yscrollcommand=recipeListScroll.set)
self.recipeList.pack(side=LEFT, fill=BOTH, expand=1)
recipeListScroll.config(command=self.recipeList.yview)
recipeListScroll.pack(side=RIGHT, fill=Y)
self.getReciepList()
self.populateRecipeList(self.recipes)
# Spacer
frameSpacer1 = Frame(self, borderwidth=1, width=10)
frameSpacer1.pack_propagate(0)
frameSpacer1.pack(side=LEFT, fill=Y)
# Recipe info section
frameRecipeInfo = Frame(self, borderwidth=1, width=200)
frameRecipeInfo.pack_propagate(0)
frameRecipeInfo.pack(side=LEFT, fill=Y)
# Recipe name
Label(frameRecipeInfo, text="Recipe Name:", anchor=E, justify=LEFT).pack()
self.recipeName = Entry(frameRecipeInfo)
self.recipeName.pack(side=TOP, fill=X)
# Prep Time
framePrepTime = Frame(frameRecipeInfo)
framePrepTime.pack(side=TOP, fill=X)
Label(framePrepTime, text="Prep Time:", anchor=E, justify=LEFT).pack()
self.prepTime = Entry(framePrepTime)
self.prepTime.pack(side=LEFT, fill=X)
default = StringVar(framePrepTime)
default.set("----")
#.........这里部分代码省略.........