本文整理汇总了Python中search.Search.grid方法的典型用法代码示例。如果您正苦于以下问题:Python Search.grid方法的具体用法?Python Search.grid怎么用?Python Search.grid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类search.Search
的用法示例。
在下文中一共展示了Search.grid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GUI
# 需要导入模块: from search import Search [as 别名]
# 或者: from search.Search import grid [as 别名]
class GUI(Tk):
"represents GUI"
def __init__(self):
super().__init__()
self.option_add("*tearOff", FALSE)
self.initialized = False
self.title("Papyer")
x, y = 1500, 500
self.minsize(x, y)
placeWindow(self, x, y)
self.options = Options(self)
self["menu"] = TopMenu(self)
self.protocol("WM_DELETE_WINDOW", self.closeFun)
self.base = os.getcwd()
self.selectVar = StringVar()
self.searchVar = StringVar()
self.createWidgets()
self.columnconfigure(1, weight = 1)
self.columnconfigure(3, weight = 1)
self.columnconfigure(5, weight = 1)
self.rowconfigure(4, weight = 1)
self.bind("<Control-d>", lambda e: self.filetree.keepDuplicates())
self.bind("<Control-a>", lambda e: self.filetree.selectAll())
self.mainloop()
def refresh(self):
# do in a smarter way - check changes in the files
self.filestorage.save()
self.filetree.saveSettings()
selected = self.filetree.selection()
self.createWidgets()
self.filetree.selection_set(selected)
def createWidgets(self):
self.selectLabel = ttk.Label(self, text = "Select:")
self.selectLabel.grid(column = 0, row = 0, padx = 10, pady = 5)
self.select = Select(self, textvariable = self.selectVar)
self.select.grid(column = 1, row = 0, sticky = (E, W))
self.searchLabel = ttk.Label(self, text = "Search:")
self.searchLabel.grid(column = 2, row = 0, padx = 10, pady = 5)
self.search = Search(self, textvariable = self.searchVar)
self.search.grid(column = 3, row = 0, sticky = (E, W))
self.filestorage = FileStorage(self)
self.filetree = FileTree(self)
self.filetree.grid(column = 0, row = 1, rowspan = 4, sticky = (N, S, E, W), columnspan = 4)
self.scrollbar = ttk.Scrollbar(self, orient = VERTICAL, command = self.filetree.yview)
self.scrollbar.grid(column = 4, row = 1, rowspan = 4, sticky = (N, S, E))
self.filetree.configure(yscrollcommand = self.scrollbar.set)
self.tags = Tags(self)
self.tags.grid(column = 5, row = 2, sticky = (E, W), padx = 5)
self.tagsLab = ttk.Label(text = "Tags")
self.tagsLab.grid(column = 5, row = 1, padx = 5, pady = 2)
self.notes = Notes(self)
self.notes.grid(column = 5, row = 4, sticky = (N, S, E, W), padx = 5)
self.notesLab = ttk.Label(text = "Notes")
self.notesLab.grid(column = 5, row = 3, padx = 5, pady = 2)
self.scrollNotes = ttk.Scrollbar(self, orient = VERTICAL, command = self.notes.yview)
self.scrollNotes.grid(column = 6, row = 4, sticky = (N, S, W))
self.notes.configure(yscrollcommand = self.scrollNotes.set)
self.buttons = Buttons(self)
self.buttons.grid(row = 5, column = 0, columnspan = 5, pady = 5, sticky = (E, W))
self.statusBar = StatusBar(self)
self.statusBar.grid(row = 6, column = 0, columnspan = 5, padx = 5, pady = 5, sticky = (E, W))
def closeFun(self):
"ask for saving files on exit"
self.filetree.saveSettings()
self.filestorage.save()
self.options.save()
self.destroy()