Advertisement
here2share

# Tk_list_all_widget_options.py

Aug 7th, 2022 (edited)
764
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.78 KB | None | 0 0
  1. # Tk_list_all_widget_options.py
  2.  
  3. from tkinter import *
  4. import tkinter
  5.  
  6. root = Tk() # needed for some of the widgets
  7.  
  8. '''
  9.    x, y = widget.x_root, widget.y_root
  10.  
  11.     OR
  12.    
  13.     row, column = widget.grid_info()   
  14.     rowspan, columnspan = widget.grid_size()
  15. '''
  16.  
  17. print('...')
  18.  
  19. # list all the widgets
  20. tk_features = []
  21. for feature in dir(tkinter):
  22.     tk_features += [feature]
  23.  
  24. widgets = []
  25. options_in_total = []
  26. for feature in tk_features:
  27.     # print(feature)
  28.     if feature.lower() not in ('image', 'tk'):
  29.         try:
  30.             options = eval(feature+'().config().keys()')
  31.             widgets += [feature]
  32.             for option in options:
  33.                 if option not in options_in_total:
  34.                     options_in_total += [option]
  35.                     print(option)
  36.         except:
  37.             try:
  38.                 options = eval(feature+'(root).config().keys()')
  39.                 widgets += [feature]
  40.                 for option in options:
  41.                     if option not in options_in_total:
  42.                         options_in_total += [option]
  43.                         print(option)
  44.             except:
  45.                 0
  46.  
  47. print('\n\n')
  48. for widget in widgets:
  49.     print(widget)
  50.  
  51. '''
  52. activebackground
  53. activeforeground
  54. anchor
  55. background
  56. bd
  57. bg
  58. bitmap
  59. borderwidth
  60. command
  61. compound
  62. cursor
  63. default
  64. disabledforeground
  65. fg
  66. font
  67. foreground
  68. height
  69. highlightbackground
  70. highlightcolor
  71. highlightthickness
  72. image
  73. justify
  74. overrelief
  75. padx
  76. pady
  77. relief
  78. repeatdelay
  79. repeatinterval
  80. state
  81. takefocus
  82. text
  83. textvariable
  84. underline
  85. width
  86. wraplength
  87. closeenough
  88. confine
  89. insertbackground
  90. insertborderwidth
  91. insertofftime
  92. insertontime
  93. insertwidth
  94. offset
  95. scrollregion
  96. selectbackground
  97. selectborderwidth
  98. selectforeground
  99. xscrollcommand
  100. xscrollincrement
  101. yscrollcommand
  102. yscrollincrement
  103. indicatoron
  104. offrelief
  105. offvalue
  106. onvalue
  107. selectcolor
  108. selectimage
  109. tristateimage
  110. tristatevalue
  111. variable
  112. disabledbackground
  113. exportselection
  114. invalidcommand
  115. invcmd
  116. readonlybackground
  117. show
  118. validate
  119. validatecommand
  120. vcmd
  121. class
  122. colormap
  123. container
  124. visual
  125. labelanchor
  126. labelwidget
  127. activestyle
  128. selectmode
  129. setgrid
  130. listvariable
  131. activeborderwidth
  132. postcommand
  133. tearoff
  134. tearoffcommand
  135. title
  136. type
  137. direction
  138. menu
  139. aspect
  140. handlepad
  141. handlesize
  142. opaqueresize
  143. orient
  144. proxybackground
  145. proxyborderwidth
  146. proxyrelief
  147. sashcursor
  148. sashpad
  149. sashrelief
  150. sashwidth
  151. showhandle
  152. value
  153. bigincrement
  154. digits
  155. from
  156. label
  157. length
  158. resolution
  159. showvalue
  160. sliderlength
  161. sliderrelief
  162. tickinterval
  163. to
  164. troughcolor
  165. activerelief
  166. elementborderwidth
  167. jump
  168. buttonbackground
  169. buttoncursor
  170. buttondownrelief
  171. buttonuprelief
  172. format
  173. increment
  174. values
  175. wrap
  176. autoseparators
  177. blockcursor
  178. endline
  179. inactiveselectbackground
  180. insertunfocussed
  181. maxundo
  182. spacing1
  183. spacing2
  184. spacing3
  185. startline
  186. tabs
  187. tabstyle
  188. undo
  189. screen
  190. use
  191.  
  192.  
  193.  
  194. Button
  195. Canvas
  196. Checkbutton
  197. Entry
  198. Frame
  199. Label
  200. LabelFrame
  201. Listbox
  202. Menu
  203. Menubutton
  204. Message
  205. PanedWindow
  206. Radiobutton
  207. Scale
  208. Scrollbar
  209. Spinbox
  210. Text
  211. Toplevel
  212. '''
  213.    
  214.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement