Advertisement
Nikmosi

Untitled

Apr 26th, 2023
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.40 KB | None | 0 0
  1. #pylint:disable=E0001
  2. import tkinter as tk
  3. from tkinter import font as fnt
  4.  
  5. master = tk.Tk()
  6.  
  7. font = (fnt.families())
  8. def destroy():
  9. master.destroy()
  10.  
  11.  
  12.  
  13. def font_1():
  14. global entry1
  15. window = tk.Tk()
  16. window.geometry("700x700")
  17. window.title("Формат")
  18. frame = tk.Frame(window, bg="blue")
  19. tk.Label(frame, text="Шрифт", anchor=tk.W).pack(side=tk.TOP, fill=tk.X)
  20. vaa = tk.StringVar(window)
  21. vaa.set("155")
  22. entry1 = tk.Entry(frame, textvariable=vaa)
  23. entry2 = tk.Entry(frame, textvariable=vaa)
  24. entry1.pack(side=tk.TOP, fill=tk.X)
  25. lb1 = tk.Listbox(frame, selectmode=tk.SINGLE)
  26. lb1.bind("<<ListboxSelect>>", lambda a: vaa.set("11"))
  27. for i in fnt.families():
  28. lb1.insert(0, i)
  29. lb1.pack(side=tk.LEFT)
  30. frame.pack(side=tk.LEFT)
  31. entry2.pack()
  32.  
  33.  
  34. def main():
  35. global text, master
  36.  
  37. menu = tk.Menu(master, tearoff=0)
  38. master.config(menu=menu)
  39.  
  40. m_file = tk.Menu(menu, tearoff=0)
  41. m_file.add_command(label="Создать")
  42. m_file.add_command(label="Открыть" )
  43. m_file.add_command(label="Сохранить")
  44. m_file.add_command(label="Сохранить как...")
  45. m_file.add_separator()
  46. m_file.add_command(label="Параметры страницы")
  47. m_file.add_command(label="Печать")
  48. m_file.add_separator()
  49. m_file.add_command(label="Выход")
  50.  
  51. m_edit = tk.Menu(menu, tearoff=0)
  52. m_edit.add_command(label="Отменить")
  53. m_edit.add_separator()
  54. m_edit.add_command(label="Вырезать")
  55. m_edit.add_command(label="Копировать")
  56. m_edit.add_command(label="Вставить")
  57. m_edit.add_command(label="Удалить")
  58. m_edit.add_separator()
  59. m_edit.add_command(label="Найти")
  60. m_edit.add_command(label="Найти далее")
  61. m_edit.add_command(label="Заменить")
  62. m_edit.add_command(label="Перейти")
  63. m_edit.add_separator()
  64. m_edit.add_command(label="Выделить все")
  65. m_edit.add_command(label="Время и дата")
  66.  
  67.  
  68. m_format = tk.Menu(menu, tearoff=0)
  69. m_format.add_command(label="Перенос по словам")
  70. m_format.add_command(label="Шрифт", command=font_1)
  71.  
  72. m_view = tk.Menu(menu, tearoff=0)
  73. m_view.add_command(label ="Маштаб")
  74. m_view.add_command(label="Строка состояния")
  75.  
  76.  
  77.  
  78. m_reference = tk.Menu(menu, tearoff=0)
  79. m_reference.add_command(label="Посмотреть справку")
  80. m_reference.add_separator()
  81. m_reference.add_command(label="О программе")
  82.  
  83. menu.add_cascade(label="Файлы", menu=m_file)
  84. menu.add_cascade(label="Правка", menu=m_edit)
  85. menu.add_cascade(label="Формат", menu=m_format)
  86. menu.add_cascade(label="Вид", menu=m_view)
  87. menu.add_cascade(label="Справка", menu=m_reference)
  88.  
  89. frame_text = tk.Frame(master)
  90. text = tk.Text(frame_text, undo=True, wrap=tk.NONE)
  91. y_scrollbar = tk.Scrollbar(frame_text, command=text.yview)
  92. x_scrollbar = tk.Scrollbar(master, command=text.xview, orient=tk.HORIZONTAL)
  93. text.config(yscrollcommand=y_scrollbar.set)
  94. text.config(xscrollcommand=x_scrollbar.set)
  95. text.pack(side=tk.LEFT)
  96. y_scrollbar.pack(side=tk.LEFT, fill=tk.Y)
  97. frame_text.pack(side=tk.TOP)
  98. x_scrollbar.pack(side=tk.TOP, fill=tk.X)
  99. master.mainloop()
  100.  
  101. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement