Advertisement
here2share

Syntax List For Tkinter

Jan 20th, 2023
831
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 7.91 KB | None | 0 0
  1. Syntax List For Tkinter
  2.  
  3. button.config(activebackground='color')
  4. button.config(relief=SUNKEN)
  5. button.config(state=DISABLED)
  6. button.config(width=10, height=2)
  7. button[n] = Button(root, text="OK", command=some_function)
  8. canvas.bbox(item)
  9. canvas.config(scrollregion=(x1, y1, x2, y2))
  10. canvas.config(xscrollcommand=scrollbar.set)
  11. canvas.config(yscrollcommand=scrollbar.set)
  12. canvas.coords(item)
  13. canvas.create_arc(x1, y1, x2, y2, start=0, extent=180)
  14. canvas.create_image(x, y, image=image)
  15. canvas.create_line(x1, y1, x2, y2)
  16. canvas.create_oval(x1, y1, x2, y2)
  17. canvas.create_polygon(x1, y1, x2, y2, x3, y3, ...)
  18. canvas.create_rectangle(x1, y1, x2, y2)
  19. canvas.create_text(x, y, text="text")
  20. canvas.delete(item)
  21. canvas.itemconfig(item, fill='color')
  22. canvas.itemconfig(item, width=2)
  23. canvas.move(item, x, y)
  24. canvas.pack()
  25. canvas.scale(item, x, y)
  26. canvas.xview_moveto(fraction)
  27. canvas.yview_moveto(fraction)
  28. canvas[n] = Canvas(root, width=width, height=height)
  29. checkbutton.config(offvalue=False)
  30. checkbutton.config(variable=checkbutton.var)
  31. checkbutton.pack()
  32. checkbutton.var = BooleanVar()
  33. checkbutton[n] = Checkbutton(root, text="Option")
  34. combobox.config(state='readonly')
  35. combobox.config(values=['option1', 'option2', 'option3'])
  36. combobox.current(index)
  37. combobox.pack()
  38. combobox[n] = ttk.Combobox(root)
  39. entry.config(show='*')
  40. entry.config(validate='key', validatecommand=some_function)
  41. entry.get()
  42. entry.pack()
  43. entry[n] = Entry(root)
  44. frame.pack()
  45. frame[n] = Frame(root)
  46. from tkinter import *
  47. image[n] = PhotoImage(file="image.png")
  48. label.config(fg="color", font=("font", size))
  49. label.config(justify=LEFT)
  50. label.config(wraplength=200)
  51. label.grid(row=0, column=0)
  52. label.pack()
  53. label[n] = Label(root, text="Test")
  54. listbox.config(activestyle=DOTBOX)
  55. listbox.config(selectmode=MULTIPLE)
  56. listbox.config(yscrollcommand=scrollbar.set)
  57. listbox.insert(END, "item")
  58. listbox.pack()
  59. listbox[n] = Listbox(root)
  60. menubar.add_cascade(label="Menu", menu=submenu)
  61. menubar.entryconfig(index, state=DISABLED)
  62. menubar[n] = Menu(root)
  63. radiobutton.config(indicatoron=False)
  64. radiobutton.config(variable=radiobutton.var)
  65. radiobutton.pack()
  66. radiobutton.var = StringVar()
  67. radiobutton[n] = Radiobutton(root, text="Option", value=value)
  68. root = Tk()
  69. root.after(time, some_function)
  70. root.after_cancel(id)
  71. root.after_idle(some_function)
  72. root.attributes('-alpha', 0.5)
  73. root.bell()
  74. root.bind("<Button-1>", button_1)
  75. root.clipboard_append("text")
  76. root.clipboard_clear()
  77. root.clipboard_get()
  78. root.config(bg="color")
  79. root.config(menu=menubar)
  80. root.deiconify()
  81. root.destroy()
  82. root.destroyed()
  83. root.event_generate(event, **kwargs)
  84. root.event_info()
  85. root.focus_force()
  86. root.focus_set()
  87. root.geometry("widthxheight+x+y")
  88. root.grab_release()
  89. root.grab_set()
  90. root.grid_columnconfigure(index, weight=1)
  91. root.grid_rowconfigure(index, weight=1)
  92. root.iconbitmap("icon.ico")
  93. root.iconbitmap('icon.ico')
  94. root.iconify()
  95. root.iconphoto(True, photo)
  96. root.is_set()
  97. root.mainloop()
  98. root.maxsize(width, height)
  99. root.minsize(width, height)
  100. root.overrideredirect(True)
  101. root.protocol("WM_DELETE_WINDOW", some_function)
  102. root.quit()
  103. root.resizable(True, True)
  104. root.resizable(width=False, height=False)
  105. root.resizable(width=True, height=True)
  106. root.state()
  107. root.state(newstate='normal')
  108. root.title("Title")
  109. root.transient(parent)
  110. root.update()
  111. root.update_idletasks()
  112. root.wait_visibility()
  113. root.wait_window()
  114. root.winfo_children()
  115. root.winfo_class()
  116. root.winfo_containing()
  117. root.winfo_depth()
  118. root.winfo_exists()
  119. root.winfo_fpixels()
  120. root.winfo_fpixels(str)
  121. root.winfo_geometry()
  122. root.winfo_height()
  123. root.winfo_id()
  124. root.winfo_ismapped()
  125. root.winfo_manager()
  126. root.winfo_name()
  127. root.winfo_parent()
  128. root.winfo_pointerx()
  129. root.winfo_pointerxy()
  130. root.winfo_pointery()
  131. root.winfo_reqheight()
  132. root.winfo_reqwidth()
  133. root.winfo_rgb()
  134. root.winfo_rgb(color)
  135. root.winfo_rootx()
  136. root.winfo_rooty()
  137. root.winfo_screen()
  138. root.winfo_screencells()
  139. root.winfo_screendepth()
  140. root.winfo_screenheight()
  141. root.winfo_screenmmheight()
  142. root.winfo_screenmmwidth()
  143. root.winfo_screenvisual()
  144. root.winfo_screenwidth()
  145. root.winfo_toplevel()
  146. root.winfo_viewable()
  147. root.winfo_visual()
  148. root.winfo_visualid()
  149. root.winfo_visualsavailable()
  150. root.winfo_width()
  151. root.winfo_x()
  152. root.winfo_y()
  153. root.withdraw()
  154. scale.config(from_=0, to=100)
  155. scale.config(orient=HORIZONTAL)
  156. scale.config(resolution=1)
  157. scale.config(tickinterval=10)
  158. scale.config(variable=scale.var)
  159. scale.pack()
  160. scale.var = DoubleVar()
  161. scale[n] = Scale(root)
  162. scale[n] = Scale(root, orient=HORIZONTAL)
  163. scrollbar.config(command=canvas.xview)
  164. scrollbar.config(command=canvas.yview)
  165. scrollbar.config(command=listbox.yview)
  166. scrollbar.pack()
  167. scrollbar.pack(side=RIGHT, fill=Y)
  168. scrollbar[n] = Scrollbar(root)
  169. spinbox.config(from_=0, to=100)
  170. spinbox.config(increment=1)
  171. spinbox.config(wrap=True)
  172. spinbox.pack()
  173. spinbox[n] = Spinbox(root)
  174. spinbox[n] = Spinbox(root, values=[1, 2, 3, 4, 5])
  175. submenu.add_command(label="Option", command=some_function)
  176. submenu[n] = Menu(menubar)
  177. text.config(height=10, width=50)
  178. text.config(state=DISABLED)
  179. text.config(wrap=WORD)
  180. text.config(xscrollcommand=scrollbar.set)
  181. text.config(yscrollcommand=scrollbar.set)
  182. text.delete(1.0, END)
  183. text.get(1.0, END)
  184. text.insert(END, "text")
  185. text.insert(INSERT, "text")
  186. text.pack()
  187. text[n] = Text(root)
  188. toplevel[n] = Toplevel(root)
  189. treeview.config(columns=('col1', 'col2'))
  190. treeview.config(show='headings')
  191. treeview.heading('#1', text='Column 1')
  192. treeview.insert('', 'end', values=('item1', 'item2'))
  193. treeview.pack()
  194. treeview[n] = ttk.Treeview(root)
  195. ttk.Button(root, text="Button")
  196. ttk.Checkbutton(root, text="Checkbutton")
  197. ttk.Combobox(root)
  198. ttk.Entry(root)
  199. ttk.Frame(root)
  200. ttk.Label(root, text="Label")
  201. ttk.Notebook(root)
  202. ttk.Progressbar(root, orient=HORIZONTAL)
  203. ttk.Progressbar(root, orient=HORIZONTAL, length=200, mode='determinate', maximum=100, value=50)
  204. ttk.Radiobutton(root, text="Radiobutton")
  205. ttk.Scale(root, orient=HORIZONTAL)
  206. ttk.Scrollbar(root)
  207. ttk.Separator(root, orient=HORIZONTAL)
  208. ttk.Spinbox(root)
  209. ttk.Style().configure("style.TButton", background="color")
  210. ttk.Style().configure("style.TButton", font=("font", size))
  211. ttk.Style().configure("style.TLabel", font=("font", size))
  212. ttk.Style().theme_use("clam")
  213. ttk.Treeview(root)
  214. ttk.Treeview(root, columns=("column1", "column2"), show='headings')
  215. ttk.notebook(root)
  216. ttk.panedwindow(root)
  217. ttk.separator(root)
  218. ttk.sizegrip(root)
  219. widget.bind("<Button-1>", function)
  220. widget.bind("<Key>", function)
  221. widget.bind("<Double-Button-1>", function)
  222. entry_widget.bind("<Return>", function)
  223. listbox.bind("<<ListboxSelect>>", function)
  224. checkbox.bind("<Button-1>", function)
  225. radiobutton.bind("<Button-1>", function)
  226. scale.bind("<ButtonRelease-1>", function)
  227. scrollbar.bind("<Button-1>", function)
  228. text_widget.bind("<Button-1>", function)
  229. window.protocol("WM_DELETE_WINDOW", function)
  230. canvas.bind("<Button-1>", function)
  231. menu.bind_all("<MenuSelect>", function)
  232. spinbox.bind("<Button-1>", function)
  233. optionmenu.bind("<Button-1>", function)
  234. treeview.bind("<Button-1>", function)
  235. notebook.bind("<Button-1>", function)
  236. label.bind("<Button-1>", function)
  237. combobox.bind("<Button-1>", function)
  238. frame.bind("<Button-1>", function)
  239. message.bind("<Button-1>", function)
  240. toplevel.bind("<Button-1>", function)
  241. panedwindow.bind("<Button-1>", function)
  242. progressbar.bind("<Button-1>", function)
  243. sizegrip.bind("<Button-1>", function)
  244. separator.bind("<Button-1>", function)
  245. notebook_tab.bind("<Button-1>", function)
  246. toolbutton.bind("<Button-1>", function)
  247. menubutton.bind("<Button-1>", function)
  248. ttk_widget.bind("<Button-1>", function)
  249. frame.bind("<Configure>", function)
  250. widget.bind("<Motion>", function)
  251. widget.bind("<Enter>", function)
  252. widget.bind("<Leave>", function)
  253. widget.bind("<FocusIn>", function)
  254. widget.bind("<FocusOut>", function)
  255. widget.after(interval, function)
  256. widget.bind("<<VirtualEvent>>", function)
  257. widget.bind("<<CustomEvent>>", function)
  258. widget.event_generate("<<EventName>>", when="tail")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement