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


Python TkUtil.menu_modifier方法代码示例

本文整理汇总了Python中TkUtil.menu_modifier方法的典型用法代码示例。如果您正苦于以下问题:Python TkUtil.menu_modifier方法的具体用法?Python TkUtil.menu_modifier怎么用?Python TkUtil.menu_modifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TkUtil的用法示例。


在下文中一共展示了TkUtil.menu_modifier方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_view_menu

# 需要导入模块: import TkUtil [as 别名]
# 或者: from TkUtil import menu_modifier [as 别名]
 def create_view_menu(self):
     modifier = TkUtil.menu_modifier()
     viewMenu = tk.Menu(self.menubar)
     viewMenu.add_checkbutton(label=BOLD, underline=0,
             image=self.menuImages[BOLD], compound=tk.LEFT,
             variable=self.bold,
             command=lambda: self.toggle_button(self.boldButton))
     viewMenu.add_checkbutton(label=ITALIC, underline=0,
             image=self.menuImages[ITALIC], compound=tk.LEFT,
             variable=self.italic,
             command=lambda: self.toggle_button(self.italicButton))
     viewMenu.add_separator()
     viewMenu.add_radiobutton(label=ALIGN_LEFT, underline=6,
             image=self.menuImages[ALIGNLEFT], compound=tk.LEFT,
             variable=self.alignment, value=tk.LEFT,
             command=self.toggle_alignment)
     viewMenu.add_radiobutton(label=ALIGN_CENTER, underline=6,
             image=self.menuImages[ALIGNCENTER],
             compound=tk.LEFT, variable=self.alignment, value=tk.CENTER,
             command=self.toggle_alignment)
     viewMenu.add_radiobutton(label=ALIGN_RIGHT, underline=6,
             image=self.menuImages[ALIGNRIGHT],
             compound=tk.LEFT, variable=self.alignment, value=tk.RIGHT,
             command=self.toggle_alignment)
     self.menubar.add_cascade(label="View", underline=0,
             menu=viewMenu)
开发者ID:ShuyaMotouchi,项目名称:joke,代码行数:28,代码来源:Main.py

示例2: create_edit_menu

# 需要导入模块: import TkUtil [as 别名]
# 或者: from TkUtil import menu_modifier [as 别名]
 def create_edit_menu(self):
     modifier = TkUtil.menu_modifier()
     self.editMenu = tk.Menu(self.menubar)
     self.editMenu.add_command(label=UNDO, underline=0,
             command=self.editor.edit_undo,
             image=self.menuImages[UNDO], compound=tk.LEFT,
             accelerator=modifier + "+Z")
     redo = "+Shift+Z"
     if TkUtil.windows():
         redo = "+Y"
     self.editMenu.add_command(label=REDO, underline=0,
             command=self.editor.edit_redo,
             image=self.menuImages[REDO], compound=tk.LEFT,
             accelerator=modifier + redo)
     self.editMenu.add_separator()
     self.editMenu.add_command(label=COPY, underline=0,
             command=lambda: self.editor.text.event_generate(
                 "<<Copy>>"), image=self.menuImages[COPY],
             compound=tk.LEFT, accelerator=modifier + "+C")
     self.editMenu.add_command(label=CUT, underline=2,
             command=lambda: self.editor.text.event_generate("<<Cut>>"),
             image=self.menuImages[CUT], compound=tk.LEFT,
             accelerator=modifier + "+X")
     self.editMenu.add_command(label=PASTE, underline=0,
             command=lambda: self.editor.text.event_generate(
                 "<<Paste>>"), image=self.menuImages[PASTE],
             compound=tk.LEFT, accelerator=modifier + "+V")
     self.editMenu.add_separator()
     self.editMenu.add_command(label=FIND + ELLIPSIS, underline=0,
             command=self.find, image=self.menuImages[FIND],
             compound=tk.LEFT, accelerator=modifier + "+F")
     self.menubar.add_cascade(label="Edit", underline=0,
             menu=self.editMenu)
开发者ID:ShuyaMotouchi,项目名称:joke,代码行数:35,代码来源:Main.py

示例3: create_file_menu

# 需要导入模块: import TkUtil [as 别名]
# 或者: from TkUtil import menu_modifier [as 别名]
 def create_file_menu(self):
     modifier = TkUtil.menu_modifier()
     self.fileMenu = tk.Menu(self.menubar, name="apple")
     self.fileMenu.add_command(label=NEW, underline=0,
             command=self.new, image=self.menuImages[NEW],
             compound=tk.LEFT, accelerator=modifier + "+N")
     self.fileMenu.add_command(label=OPEN + ELLIPSIS, underline=0,
             command=self.open, image=self.menuImages[OPEN],
             compound=tk.LEFT, accelerator=modifier + "+O")
     self.fileMenu.add_cascade(label=OPEN_RECENT,
             underline=5, image=self.menuImages[OPEN],
             compound=tk.LEFT)
     self.fileMenu.add_command(label=SAVE, underline=0,
             command=self.save, image=self.menuImages[SAVE],
             compound=tk.LEFT, accelerator=modifier + "+S")
     self.fileMenu.add_command(label=SAVE_AS + ELLIPSIS, underline=5,
             command=self.save_as, image=self.menuImages[SAVEAS],
             compound=tk.LEFT)
     if TkUtil.mac():
         self.master.createcommand("::tk::mac::ShowPreferences",
                 self.preferences)
         self.master.createcommand("exit", self.close)
     else:
         self.fileMenu.add_separator()
         self.fileMenu.add_command(label=PREFERENCES + ELLIPSIS,
                 underline=0, image=self.menuImages[PREFERENCES],
                 compound=tk.LEFT, command=self.preferences)
         self.fileMenu.add_separator()
         self.fileMenu.add_command(label=QUIT, underline=0,
                 command=self.close, compound=tk.LEFT,
                 image=self.menuImages[QUIT],
                 accelerator=modifier + "+Q")
     self.menubar.add_cascade(label="File", underline=0,
             menu=self.fileMenu)
开发者ID:ShuyaMotouchi,项目名称:joke,代码行数:36,代码来源:Main.py

示例4: create_window_menu

# 需要导入模块: import TkUtil [as 别名]
# 或者: from TkUtil import menu_modifier [as 别名]
 def create_window_menu(self):
     modifier = TkUtil.menu_modifier()
     self.windowMenu = tk.Menu(self.menubar, name="window")
     self.windowToolbarMenu = tk.Menu(self.windowMenu)
     self.windowMenu.add_cascade(label="Toolbars", underline=0, menu=self.windowToolbarMenu)
     self.windowMenu.add_cascade(label="Dock Windows", underline=0)
     self.menubar.add_cascade(label="Window", underline=0, menu=self.windowMenu)
开发者ID:johnobrien,项目名称:PyPractice,代码行数:9,代码来源:Main.py

示例5: create_file_menu

# 需要导入模块: import TkUtil [as 别名]
# 或者: from TkUtil import menu_modifier [as 别名]
 def create_file_menu(self):
     # Ctrl is nicer than Control for menus
     modifier = TkUtil.menu_modifier()
     fileMenu = tk.Menu(self.menubar, name="apple")
     fileMenu.add_command(label=NEW, underline=0,
             command=self.board.new_game, compound=tk.LEFT,
             image=self.images[NEW], accelerator=modifier + "+N")
     if TkUtil.mac():
         self.master.createcommand("exit", self.close)
     else:
         fileMenu.add_separator()
         fileMenu.add_command(label="Quit", underline=0,
                 command=self.close, compound=tk.LEFT,
                 image=self.images[CLOSE],
                 accelerator=modifier + "+Q")
     self.menubar.add_cascade(label="File", underline=0,
             menu=fileMenu)
开发者ID:GuoTianqi,项目名称:PythonInPractice-MarkSummerfield,代码行数:19,代码来源:Main.py

示例6: context_menu

# 需要导入模块: import TkUtil [as 别名]
# 或者: from TkUtil import menu_modifier [as 别名]
 def context_menu(self, event):
     modifier = TkUtil.menu_modifier()
     menu = tk.Menu(self.master)
     if self.editor.text.tag_ranges(tk.SEL):
         menu.add_command(label=COPY, underline=0,
                 command=lambda: self.editor.text.event_generate(
                     "<<Copy>>"), image=self.menuImages[COPY],
                 compound=tk.LEFT, accelerator=modifier + "+C")
         menu.add_command(label=CUT, underline=2,
                 command=lambda: self.editor.text.event_generate(
                     "<<Cut>>"), image=self.menuImages[CUT],
                 compound=tk.LEFT, accelerator=modifier + "+X")
     menu.add_command(label=PASTE, underline=0,
             command=lambda: self.editor.text.event_generate(
                 "<<Paste>>"), image=self.menuImages[PASTE],
             compound=tk.LEFT, accelerator=modifier + "+V")
     menu.add_separator()
     menu.add_checkbutton(label=BOLD, underline=0,
             image=self.menuImages[BOLD], compound=tk.LEFT,
             variable=self.bold,
             command=lambda: self.toggle_button(self.boldButton))
     menu.add_checkbutton(label=ITALIC, underline=0,
             image=self.menuImages[ITALIC], compound=tk.LEFT,
             variable=self.italic,
             command=lambda: self.toggle_button(self.italicButton))
     menu.add_separator()
     menu.add_radiobutton(label=ALIGN_LEFT, underline=6,
             image=self.menuImages[ALIGNLEFT], compound=tk.LEFT,
             variable=self.alignment, value=tk.LEFT,
             command=self.toggle_alignment)
     menu.add_radiobutton(label=ALIGN_CENTER, underline=6,
             image=self.menuImages[ALIGNCENTER],
             compound=tk.LEFT, variable=self.alignment, value=tk.CENTER,
             command=self.toggle_alignment)
     menu.add_radiobutton(label=ALIGN_RIGHT, underline=6,
             image=self.menuImages[ALIGNRIGHT],
             compound=tk.LEFT, variable=self.alignment, value=tk.RIGHT,
             command=self.toggle_alignment)
     menu.tk_popup(event.x_root, event.y_root)
开发者ID:ShuyaMotouchi,项目名称:joke,代码行数:41,代码来源:Main.py


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