Giới thiệu sản phẩm
import tkinter as tk
def new():
print("New file created")
def undo():
print("Undo action")
window = tk.Tk()
window.geometry("500x500")
root_menu = tk.Menu(window)
window.config(menu=root_menu)
file_menu = tk.Menu(root_menu)
edit_menu = tk.Menu(root_menu)
selection_menu = tk.Menu(root_menu)
view_menu = tk.Menu(root_menu)
preferences_menu = tk.Menu(file_menu)
terminal_menu = tk.Menu(root_menu)
root_menu.add_cascade(label="File", menu=file_menu)
root_menu.add_cascade(label="Edit", menu=edit_menu)
root_menu.add_cascade(label="Selection", menu=selection_menu)
root_menu.add_cascade(label="View", menu=view_menu)
root_menu.add_cascade(label="Terminal", menu=terminal_menu)
file_menu.add_command(label="New", accelerator="Ctrl+N", command=new)
file_menu.add_command(label="Open", accelerator="Ctrl+O")
file_menu.add_separator()
file_menu.add_command(label="New Text File")
file_menu.add_command(label="New File")
file_menu.add_command(label="New Window")
file_menu.add_cascade(label="Preferences", menu=preferences_menu)
preferences_menu.add_command(label="Settings")
preferences_menu.add_command(label="Profile")
preferences_menu.add_command(label="Extensions")
edit_menu.add_separator()
edit_menu.add_command(label="Undo", accelerator="Ctrl+Z", command=undo)
edit_menu.add_command(label="Redo", accelerator="Ctrl+Y")
edit_menu.add_separator()
edit_menu.add_command(label="Cut", accelerator="Ctrl+X")
edit_menu.add_command(label="Copy", accelerator="Ctrl+C")
edit_menu.add_command(label="Paste", accelerator="Ctrl+V")
edit_menu.add_separator()
edit_menu.add_command(label="Find", accelerator="Ctrl+F")
edit_menu.add_command(label="Replace", accelerator="Ctrl+H")
edit_menu.add_separator()
edit_menu.add_command(label="Find in File", accelerator="Ctrl+Shift+F")
edit_menu.add_command(label="Replace in File", accelerator="Ctrl+Shift+H")
edit_menu.add_separator()
edit_menu.add_command(label="Toggle Line Comment", accelerator="Ctrl+/")
edit_menu.add_command(label="Toggle Block Comment", accelerator="Shift+Alt+A")
edit_menu.add_command(label="Emmet: Expand Abbreviation", accelerator="Tab")
terminal_menu.add_command(label="New Terminal", accelerator="Ctrl+Shift+'", command=undo)
terminal_menu.add_command(label="Split Terminal", accelerator="Ctrl+Shift+5")
terminal_menu.add_separator()
terminal_menu.add_command(label="Run Task")
terminal_menu.add_command(label="Run Build Task", accelerator="Ctrl+Shift+B")
terminal_menu.add_command(label="Run Active File")
terminal_menu.add_command(label="Run Selected File")
terminal_menu.add_separator()
terminal_menu.add_command(label="Configure Task")
terminal_menu.add_command(label="Configure Default Build Task")
window.bind("<Control-z>", lambda e: undo())
window.mainloop()
Hình ảnh sản phẩm
Hãy bình luận để nhặt 100 thóc nhé
Sản phẩm cùng tác giả
Sản phẩm liên quan
Không có sản phẩm nào
Đăng nhập để tham gia bình luận