当前位置: 首页>>代码示例>>Python>>正文


Python Tk.focus_set方法代码示例

本文整理汇总了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
开发者ID:gokai,项目名称:tim,代码行数:36,代码来源:mainview.py

示例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()
开发者ID:Emma920,项目名称:visual,代码行数:14,代码来源:ObjectBrowser.py

示例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()
开发者ID:nonbeing,项目名称:cpython,代码行数:16,代码来源:ObjectBrowser.py

示例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()
开发者ID:felixlu,项目名称:pyBooguNote,代码行数:32,代码来源:pyBooguNote.py


注:本文中的tkinter.Tk.focus_set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。