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

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

项目:Craft-Clash    作者:Derpyface-Development-Co    | 项目源码 | 文件源码
def create(self, **kwargs):
        return ttk.Menubutton(self.root, **kwargs)
项目:Craft-Clash    作者:Derpyface-Development-Co    | 项目源码 | 文件源码
def create(self, **kwargs):
        return ttk.Menubutton(self.root, **kwargs)
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def toc_menu(self, text):
        "Create table of contents as drop-down menu."
        toc = Menubutton(self, text='TOC')
        drop = Menu(toc, tearoff=False)
        for lbl, dex in text.parser.toc:
            drop.add_command(label=lbl, command=lambda dex=dex:text.yview(dex))
        toc['menu'] = drop
        return toc
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def toc_menu(self, text):
        "Create table of contents as drop-down menu."
        toc = Menubutton(self, text='TOC')
        drop = Menu(toc, tearoff=False)
        for lbl, dex in text.parser.toc:
            drop.add_command(label=lbl, command=lambda dex=dex:text.yview(dex))
        toc['menu'] = drop
        return toc
项目:Colony    作者:DeflatedPickle    | 项目源码 | 文件源码
def add_button(self, text: str = "", menu: tk.Menu = None):
        button = ttk.Menubutton(self, text=text, menu=menu, direction="above")
        button.pack(side="left", fill="x", expand=True)

        return button
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def create(self, **kwargs):
        return ttk.Menubutton(self.root, **kwargs)
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def toc_menu(self, text):
        "Create table of contents as drop-down menu."
        toc = Menubutton(self, text='TOC')
        drop = Menu(toc, tearoff=False)
        for lbl, dex in text.parser.toc:
            drop.add_command(label=lbl, command=lambda dex=dex:text.yview(dex))
        toc['menu'] = drop
        return toc
项目:quill    作者:DeflatedPickle    | 项目源码 | 文件源码
def insert_tk_menubutton(self, index: int or str="end", *args, **kwargs):
        """Insert a tk.Menubutton into the game."""
        widget = tk.Menubutton(self.text, **kwargs)
        self.text.window_create(index, window=widget)

        return widget
项目:quill    作者:DeflatedPickle    | 项目源码 | 文件源码
def insert_ttk_menubutton(self, direction: str="below", menu: tk.Menu=None, index: int or str="end", *args, **kwargs):
        """Insert a ttk.Menubutton into the game."""
        widget = ttk.Menubutton(self.text, direction=direction, menu=menu, **kwargs)
        self.text.window_create(index, window=widget)

        return widget
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
def create(self, **kwargs):
        return ttk.Menubutton(self.root, **kwargs)