本文整理汇总了Python中tkinter.Tk.focus_set方法的典型用法代码示例。如果您正苦于以下问题:Python Tk.focus_set方法的具体用法?Python Tk.focus_set怎么用?Python Tk.focus_set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.Tk
的用法示例。
在下文中一共展示了Tk.focus_set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import focus_set [as 别名]
def __init__(self, title):
root = Tk()
root.title(title)
root.focus_set()
root.rowconfigure(0, weight=0)
root.columnconfigure(0, weight=1)
root.rowconfigure(1, weight=1)
self._root = root
self.menubar = Frame(root)
self.menubar.grid(row=0, column=0, sticky=(W, E))
self.menubar['takefocus'] = False
quit_button = Button(self.menubar, text='Quit', command=self.quit)
quit_button.grid(row=0, column=0)
self._menucolumn = 1
self.views = list()
self.paned_win = PanedWindow(root, orient=HORIZONTAL)
self.paned_win.grid(row=1, column=0, sticky=(N, S, W, E))
self._query = None
self._accept_func = None
self.sidebar_views = dict()
self.sidebar_count = 0
self.sidebar = PanedWindow(self.paned_win)
self.paned_win.add(self.sidebar, weight=1)
self.tabs = Notebook(self.paned_win)
self.tabs.enable_traversal()
self.paned_win.add(self.tabs, weight=5)
self.root = self.tabs
示例2: _test
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import focus_set [as 别名]
def _test():
import sys
from tkinter import Tk
root = Tk()
root.configure(bd=0, bg="yellow")
root.focus_set()
sc = ScrolledCanvas(root, bg="white", highlightthickness=0, takefocus=1)
sc.frame.pack(expand=1, fill="both")
item = make_objecttreeitem("sys", sys)
node = TreeNode(sc.canvas, None, item)
node.update()
root.mainloop()
示例3: _object_browser
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import focus_set [as 别名]
def _object_browser(parent):
import sys
from tkinter import Tk
root = Tk()
width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
root.geometry("+%d+%d"%(x, y + 100))
root.configure(bd=0, bg="yellow")
root.focus_set()
sc = ScrolledCanvas(root, bg="white", highlightthickness=0, takefocus=1)
sc.frame.pack(expand=1, fill="both")
item = make_objecttreeitem("sys", sys)
node = TreeNode(sc.canvas, None, item)
node.update()
root.mainloop()
示例4: create_toolbar
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import focus_set [as 别名]
def create_toolbar(self):
self.toolbar = Frame(self.parent)
self.btn_new = Button(self.toolbar, text='New', command=self.new_file)
self.btn_new.grid(row=0, column=0)
self.btn_open = Button(self.toolbar, text='Open', command=self.open_file)
self.btn_open.grid(row=0, column=1)
self.toolbar.pack(fill='both')
def open_file(self):
self.file_path = askopenfilename(filetypes=[('BooguNote Files', '.boo')])
self.dom = parse(self.file_path)
curItem = None
pyBt = PyBooguTree(self.sc.canvas, self.file_path, self.dom)
def new_file(self):
self.file_path = asksaveasfilename()
print(self.file_path)
def writeDom2File(dom, file_path):
f = codecs.open(file_path, 'w', 'utf-8')
dom.writexml(f, encoding='UTF-8')
f.close()
if __name__ == '__main__':
app = Tk()
app.configure(bd=0, bg="yellow")
app.focus_set()
pyBn = PyBooguNote(app)
app.mainloop()