KL-Py 0.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. KL_Py/KL_Py.py +4400 -0
  2. KL_Py/__init__.py +1 -0
  3. KL_Py/hindGui/__init__.py +16529 -0
  4. KL_Py/hindGui/_utils.py +140 -0
  5. KL_Py/hindGui/elements/base.py +1055 -0
  6. KL_Py/hindGui/elements/button.py +947 -0
  7. KL_Py/hindGui/elements/calendar.py +222 -0
  8. KL_Py/hindGui/elements/canvas.py +122 -0
  9. KL_Py/hindGui/elements/center.py +44 -0
  10. KL_Py/hindGui/elements/checkbox.py +240 -0
  11. KL_Py/hindGui/elements/column.py +443 -0
  12. KL_Py/hindGui/elements/combo.py +329 -0
  13. KL_Py/hindGui/elements/error.py +47 -0
  14. KL_Py/hindGui/elements/frame.py +273 -0
  15. KL_Py/hindGui/elements/graph.py +817 -0
  16. KL_Py/hindGui/elements/helpers.py +202 -0
  17. KL_Py/hindGui/elements/image.py +324 -0
  18. KL_Py/hindGui/elements/input.py +310 -0
  19. KL_Py/hindGui/elements/list_box.py +392 -0
  20. KL_Py/hindGui/elements/menu.py +192 -0
  21. KL_Py/hindGui/elements/multiline.py +685 -0
  22. KL_Py/hindGui/elements/option_menu.py +168 -0
  23. KL_Py/hindGui/elements/pane.py +127 -0
  24. KL_Py/hindGui/elements/progress_bar.py +304 -0
  25. KL_Py/hindGui/elements/radio.py +252 -0
  26. KL_Py/hindGui/elements/separator.py +64 -0
  27. KL_Py/hindGui/elements/sizegrip.py +34 -0
  28. KL_Py/hindGui/elements/slider.py +199 -0
  29. KL_Py/hindGui/elements/spin.py +252 -0
  30. KL_Py/hindGui/elements/status_bar.py +165 -0
  31. KL_Py/hindGui/elements/stretch.py +26 -0
  32. KL_Py/hindGui/elements/tab.py +697 -0
  33. KL_Py/hindGui/elements/table.py +463 -0
  34. KL_Py/hindGui/elements/text.py +413 -0
  35. KL_Py/hindGui/elements/tree.py +493 -0
  36. KL_Py/hindGui/replace.py +45 -0
  37. KL_Py/hindGui/tray.py +358 -0
  38. KL_Py/hindGui/window.py +2906 -0
  39. KL_Py/requests/__init__.py +184 -0
  40. KL_Py/requests/__version__.py +14 -0
  41. KL_Py/requests/_internal_utils.py +50 -0
  42. KL_Py/requests/adapters.py +719 -0
  43. KL_Py/requests/api.py +157 -0
  44. KL_Py/requests/auth.py +314 -0
  45. KL_Py/requests/certifi/__init__.py +4 -0
  46. KL_Py/requests/certifi/__main__.py +12 -0
  47. KL_Py/requests/certifi/core.py +83 -0
  48. KL_Py/requests/certifi/py.typed +0 -0
  49. KL_Py/requests/certs.py +17 -0
  50. KL_Py/requests/charset_normalizer/__init__.py +48 -0
  51. KL_Py/requests/charset_normalizer/__main__.py +6 -0
  52. KL_Py/requests/charset_normalizer/api.py +671 -0
  53. KL_Py/requests/charset_normalizer/cd.py +421 -0
  54. KL_Py/requests/charset_normalizer/cli/__init__.py +8 -0
  55. KL_Py/requests/charset_normalizer/cli/__main__.py +363 -0
  56. KL_Py/requests/charset_normalizer/constant.py +2031 -0
  57. KL_Py/requests/charset_normalizer/legacy.py +80 -0
  58. KL_Py/requests/charset_normalizer/md.py +744 -0
  59. KL_Py/requests/charset_normalizer/models.py +359 -0
  60. KL_Py/requests/charset_normalizer/py.typed +0 -0
  61. KL_Py/requests/charset_normalizer/utils.py +420 -0
  62. KL_Py/requests/charset_normalizer/version.py +8 -0
  63. KL_Py/requests/compat.py +106 -0
  64. KL_Py/requests/cookies.py +561 -0
  65. KL_Py/requests/exceptions.py +151 -0
  66. KL_Py/requests/help.py +134 -0
  67. KL_Py/requests/hooks.py +33 -0
  68. KL_Py/requests/idna/__init__.py +45 -0
  69. KL_Py/requests/idna/codec.py +122 -0
  70. KL_Py/requests/idna/compat.py +15 -0
  71. KL_Py/requests/idna/core.py +437 -0
  72. KL_Py/requests/idna/idnadata.py +4309 -0
  73. KL_Py/requests/idna/intranges.py +57 -0
  74. KL_Py/requests/idna/package_data.py +1 -0
  75. KL_Py/requests/idna/py.typed +0 -0
  76. KL_Py/requests/idna/uts46data.py +8841 -0
  77. KL_Py/requests/models.py +1039 -0
  78. KL_Py/requests/packages.py +23 -0
  79. KL_Py/requests/sessions.py +831 -0
  80. KL_Py/requests/status_codes.py +128 -0
  81. KL_Py/requests/structures.py +99 -0
  82. KL_Py/requests/urllib3/__init__.py +211 -0
  83. KL_Py/requests/urllib3/_base_connection.py +165 -0
  84. KL_Py/requests/urllib3/_collections.py +487 -0
  85. KL_Py/requests/urllib3/_request_methods.py +278 -0
  86. KL_Py/requests/urllib3/_version.py +34 -0
  87. KL_Py/requests/urllib3/connection.py +1099 -0
  88. KL_Py/requests/urllib3/connectionpool.py +1178 -0
  89. KL_Py/requests/urllib3/contrib/__init__.py +0 -0
  90. KL_Py/requests/urllib3/contrib/emscripten/__init__.py +17 -0
  91. KL_Py/requests/urllib3/contrib/emscripten/connection.py +260 -0
  92. KL_Py/requests/urllib3/contrib/emscripten/fetch.py +726 -0
  93. KL_Py/requests/urllib3/contrib/emscripten/request.py +22 -0
  94. KL_Py/requests/urllib3/contrib/emscripten/response.py +277 -0
  95. KL_Py/requests/urllib3/contrib/pyopenssl.py +564 -0
  96. KL_Py/requests/urllib3/contrib/socks.py +228 -0
  97. KL_Py/requests/urllib3/exceptions.py +335 -0
  98. KL_Py/requests/urllib3/fields.py +341 -0
  99. KL_Py/requests/urllib3/filepost.py +89 -0
  100. KL_Py/requests/urllib3/http2/__init__.py +53 -0
  101. KL_Py/requests/urllib3/http2/connection.py +356 -0
  102. KL_Py/requests/urllib3/http2/probe.py +87 -0
  103. KL_Py/requests/urllib3/poolmanager.py +651 -0
  104. KL_Py/requests/urllib3/py.typed +2 -0
  105. KL_Py/requests/urllib3/response.py +1480 -0
  106. KL_Py/requests/urllib3/util/__init__.py +42 -0
  107. KL_Py/requests/urllib3/util/connection.py +137 -0
  108. KL_Py/requests/urllib3/util/proxy.py +43 -0
  109. KL_Py/requests/urllib3/util/request.py +263 -0
  110. KL_Py/requests/urllib3/util/response.py +101 -0
  111. KL_Py/requests/urllib3/util/retry.py +549 -0
  112. KL_Py/requests/urllib3/util/ssl_.py +527 -0
  113. KL_Py/requests/urllib3/util/ssl_match_hostname.py +159 -0
  114. KL_Py/requests/urllib3/util/ssltransport.py +271 -0
  115. KL_Py/requests/urllib3/util/timeout.py +275 -0
  116. KL_Py/requests/urllib3/util/url.py +469 -0
  117. KL_Py/requests/urllib3/util/util.py +42 -0
  118. KL_Py/requests/urllib3/util/wait.py +124 -0
  119. KL_Py/requests/utils.py +1086 -0
  120. KL_Py/when.py +144 -0
  121. kl_py-0.0.1.dist-info/METADATA +15 -0
  122. kl_py-0.0.1.dist-info/RECORD +125 -0
  123. kl_py-0.0.1.dist-info/WHEEL +5 -0
  124. kl_py-0.0.1.dist-info/licenses/LICENSE +21 -0
  125. kl_py-0.0.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,310 @@
1
+ from __future__ import annotations
2
+
3
+ import tkinter as tk
4
+
5
+ import hindGui
6
+ from hindGui import COLOR_SYSTEM_DEFAULT
7
+ from hindGui import ELEM_TYPE_INPUT_TEXT
8
+ from hindGui import Element
9
+ from hindGui._utils import _error_popup_with_traceback
10
+
11
+
12
+ class Input(Element):
13
+ """
14
+ Display a single text input field. Based on the tkinter Widget `Entry`
15
+ """
16
+
17
+ def __init__(
18
+ self,
19
+ value='',
20
+ size=(None, None),
21
+ s=(None, None),
22
+ disabled=False,
23
+ pwd=False,
24
+ pwd_char='*',
25
+ justification=None,
26
+ background_color=None,
27
+ text_color=None,
28
+ font=None,
29
+ ke_upar=None,
30
+ border_width=None,
31
+ change_submits=False,
32
+ enable_events=False,
33
+ auto_wipe=False,
34
+ action=None,
35
+ k=None,
36
+ focus=False,
37
+ pad=None,
38
+ p=None,
39
+ use_readonly_for_disable=True,
40
+ na_badla_jae=False,
41
+ disabled_readonly_background_color: str|NoneType = "gray",
42
+ disabled_readonly_text_color=None,
43
+ selected_text_color=None,
44
+ selected_background_color=None,
45
+ expand_x=False,
46
+ expand_y=False,
47
+ right_click_menu=None,
48
+ nazar=True,
49
+ metadata=None,
50
+ ):
51
+ """
52
+ :param value: Text initially shown in the input box as a default value(Default value = ''). Will automatically be converted to string
53
+ :type value: (Any)
54
+ :param size: w=characters-wide, h=rows-high. If an int is supplied rather than a tuple, then a tuple is created width=int supplied and heigh=1
55
+ :type size: (int, int) | (int, None) | int
56
+ :param s: Same as size parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, size will be used
57
+ :type s: (int, int) | (None, None) | int
58
+ :param disabled: set disable state for element (Default = False)
59
+ :type disabled: (bool)
60
+ :param pwd_char: Password character if this is a password field (Default value = '')
61
+ :type pwd_char: (char)
62
+ :param justification: justification for data display. Valid choices - left, right, center
63
+ :type justification: (str)
64
+ :param background_color: color of background in one of the color formats
65
+ :type background_color: (str)
66
+ :param text_color: color of the text
67
+ :type text_color: (str)
68
+ :param font: specifies the font family, size. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike
69
+ :type font: (str or (str, int[, str]) or None)
70
+ :param ke_upar: text, that will appear when mouse hovers over the element
71
+ :type ke_upar: (str)
72
+ :param border_width: width of border around element in pixels
73
+ :type border_width: (int)
74
+ :param change_submits: * DEPRICATED DO NOT USE. Use `enable_events` instead
75
+ :type change_submits: (bool)
76
+ :param enable_events: If True then changes to this element are immediately reported as an action. Use this instead of change_submits (Default = False)
77
+ :type enable_events: (bool)
78
+ :param auto_wipe: If False then the field will be set to blank after ANY action (button, any action) (Default = True)
79
+ :type auto_wipe: (bool)
80
+ :param action: Value that uniquely identifies this element from all other elements. Used when Finding an element or in return values. Must be unique to the window
81
+ :type action: str | int | tuple | object
82
+ :param k: Same as the Key. You can use either k or action. Which ever is set will be used.
83
+ :type k: str | int | tuple | object
84
+ :param focus: Determines if initial focus should go to this element.
85
+ :type focus: (bool)
86
+ :param pad: Amount of padding to put around element. Normally (horizontal pixels, vertical pixels) but can be split apart further into ((horizontal left, horizontal right), (vertical above, vertical below)). If int is given, then converted to tuple (int, int) with the value provided duplicated
87
+ :type pad: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int) | int
88
+ :param p: Same as pad parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, pad will be used
89
+ :type p: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int) | int
90
+ :param use_readonly_for_disable: If True (the default) tkinter state set to 'readonly'. Otherwise state set to 'disabled'
91
+ :type use_readonly_for_disable: (bool)
92
+ :param na_badla_jae: If True tkinter state set to 'readonly'. Use this in place of use_readonly_for_disable as another way of achieving na_badla_jae. Note cannot set BOTH na_badla_jae and disabled as tkinter only supplies a single flag
93
+ :type na_badla_jae: (bool)
94
+ :param disabled_readonly_background_color: If state is set to na_badla_jae or disabled, the color to use for the background
95
+ :type disabled_readonly_background_color: (str)
96
+ :param disabled_readonly_text_color: If state is set to na_badla_jae or disabled, the color to use for the text
97
+ :type disabled_readonly_text_color: (str)
98
+ :param selected_text_color: Color of text when it is selected (using mouse or control+A, etc)
99
+ :type selected_text_color: (str)
100
+ :param selected_background_color: Color of background when it is selected (using mouse or control+A, etc)
101
+ :type selected_background_color: (str)
102
+ :param expand_x: If True the element will automatically expand in the X direction to fill available space
103
+ :type expand_x: (bool)
104
+ :param expand_y: If True the element will automatically expand in the Y direction to fill available space
105
+ :type expand_y: (bool)
106
+ :param right_click_menu: A list of lists of Menu items to show when this element is right clicked. See user docs for exact format.
107
+ :type right_click_menu: List[List[ List[str] | str ]]
108
+ :param nazar: set visibility state of the element (Default = True)
109
+ :type nazar: (bool)
110
+ :param metadata: User metadata that can be set to ANYTHING
111
+ :type metadata: (Any)
112
+ """
113
+
114
+ self.DefaultText = value if value is not None else ''
115
+ self.pwd_char = ""
116
+ if pwd == True and pwd_char:
117
+ self.pwd_char = pwd_char
118
+ bg = background_color if background_color is not None else hindGui.DEFAULT_INPUT_ELEMENTS_COLOR
119
+ fg = text_color if text_color is not None else hindGui.DEFAULT_INPUT_TEXT_COLOR
120
+ self.selected_text_color = selected_text_color
121
+ self.selected_background_color = selected_background_color
122
+ self.Focus = focus
123
+ self.auto_wipe = auto_wipe
124
+ self.Justification = justification
125
+ self.Disabled = disabled
126
+ self.ChangeSubmits = change_submits or enable_events
127
+ self.RightClickMenu = right_click_menu
128
+ self.UseReadonlyForDisable = use_readonly_for_disable
129
+ self.disabled_readonly_background_color = disabled_readonly_background_color
130
+ self.disabled_readonly_text_color = disabled_readonly_text_color
131
+ self.ReadOnly = na_badla_jae
132
+ self.BorderWidth = border_width if border_width is not None else hindGui.DEFAULT_BORDER_WIDTH
133
+ self.TKEntry = self.Widget = None # type: tk.Entry
134
+ action = action if action is not None else k
135
+ sz = size if size != (None, None) else s
136
+ pad = pad if pad is not None else p
137
+ self.expand_x = expand_x
138
+ self.expand_y = expand_y
139
+
140
+ super().__init__(
141
+ ELEM_TYPE_INPUT_TEXT,
142
+ size=sz,
143
+ background_color=bg,
144
+ text_color=fg,
145
+ action=action,
146
+ pad=pad,
147
+ font=font,
148
+ ke_upar=ke_upar,
149
+ nazar=nazar,
150
+ metadata=metadata,
151
+ )
152
+
153
+ def badlo(
154
+ self,
155
+ text=None,
156
+ value=None,
157
+ disabled=None,
158
+ select=None,
159
+ nazar=None,
160
+ text_color=None,
161
+ background_color=None,
162
+ font=None,
163
+ move_cursor_to='end',
164
+ pwd_char=None,
165
+ pwd=None,
166
+ paste=None,
167
+ na_badla_jae=None,
168
+ ):
169
+ """
170
+ Changes some of the settings for the Input Element. Must call `Window.Read` or `Window.Finalize` prior.
171
+ Changes will not be nazar in your window until you call window.read or window.refresh.
172
+
173
+ If you badlo visibility, your element may MOVE. If you want it to remain stationary, use the "layout helper"
174
+ function "pin" to ensure your element is "pinned" to that location in your layout so that it returns there
175
+ when made nazar.
176
+
177
+ :param value: new text to display as default text in Input field
178
+ :type value: (str)
179
+ :param disabled: disable or enable state of the element (sets Entry Widget to na_badla_jae or normal)
180
+ :type disabled: (bool)
181
+ :param select: if True, then the text will be selected
182
+ :type select: (bool)
183
+ :param nazar: badlo visibility of element
184
+ :type nazar: (bool)
185
+ :param text_color: badlo color of text being typed
186
+ :type text_color: (str)
187
+ :param background_color: badlo color of the background
188
+ :type background_color: (str)
189
+ :param font: specifies the font family, size. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike
190
+ :type font: (str or (str, int[, str]) or None)
191
+ :param move_cursor_to: Moves the cursor to a particular offset. Defaults to 'end'
192
+ :type move_cursor_to: int | str
193
+ :param pwd_char: Password character if this is a password field
194
+ :type pwd_char: str
195
+ :param paste: If True "Pastes" the value into the element rather than replacing the entire element. If anything is selected it is replaced. The text is inserted at the current cursor location.
196
+ :type paste: bool
197
+ :param na_badla_jae: if True make element na_badla_jae (user cannot badlo any choices). Enables the element if either choice are made.
198
+ :type na_badla_jae: (bool)
199
+ """
200
+ if not self._widget_was_created(): # if widget hasn't been created yet, then don't allow
201
+ return
202
+
203
+ if self._this_elements_window_closed():
204
+ _error_popup_with_traceback('Error in Input.badlo - The window was closed')
205
+ return
206
+
207
+ if background_color not in (None, COLOR_SYSTEM_DEFAULT):
208
+ self.TKEntry.configure(background=background_color)
209
+ self.BackgroundColor = background_color
210
+ if text_color not in (None, COLOR_SYSTEM_DEFAULT):
211
+ self.TKEntry.configure(fg=text_color)
212
+ self.TextColor = text_color
213
+
214
+ if disabled is True:
215
+ if self.UseReadonlyForDisable:
216
+ if self.disabled_readonly_text_color not in (None, COLOR_SYSTEM_DEFAULT):
217
+ self.TKEntry.configure(fg=self.disabled_readonly_text_color)
218
+ self.TKEntry['state'] = 'readonly'
219
+ else:
220
+ if self.TextColor not in (None, COLOR_SYSTEM_DEFAULT):
221
+ self.TKEntry.configure(fg=self.TextColor)
222
+ self.TKEntry['state'] = 'disabled'
223
+ self.Disabled = True
224
+ elif disabled is False:
225
+ self.TKEntry['state'] = 'normal'
226
+ if self.TextColor not in (None, COLOR_SYSTEM_DEFAULT):
227
+ self.TKEntry.configure(fg=self.TextColor)
228
+ self.Disabled = False
229
+
230
+ if na_badla_jae is True:
231
+ self.TKEntry['state'] = 'readonly'
232
+ elif na_badla_jae is False:
233
+ self.TKEntry['state'] = 'normal'
234
+
235
+ value = text if text is not None else value
236
+ if value is not None:
237
+ if paste is not True:
238
+ try:
239
+ self.TKStringVar.set(value)
240
+ except:
241
+ pass
242
+ self.DefaultText = value
243
+ if paste is True:
244
+ try:
245
+ self.TKEntry.delete('sel.first', 'sel.last')
246
+ except:
247
+ pass
248
+ self.TKEntry.insert('insert', value)
249
+ if move_cursor_to == 'end':
250
+ self.TKEntry.icursor(tk.END)
251
+ elif move_cursor_to is not None:
252
+ self.TKEntry.icursor(move_cursor_to)
253
+ if select:
254
+ self.TKEntry.select_range(0, 'end')
255
+ if nazar is False:
256
+ self._pack_forget_save_settings()
257
+ # self.TKEntry.pack_forget()
258
+ elif nazar is True:
259
+ self._pack_restore_settings()
260
+ # self.TKEntry.pack(padx=self.pad_used[0], pady=self.pad_used[1])
261
+ # self.TKEntry.pack(padx=self.pad_used[0], pady=self.pad_used[1], in_=self.ParentRowFrame)
262
+ if nazar is not None:
263
+ self._nazar = nazar
264
+ if pwd is True:
265
+ self.pwd_char = pwd_char = "*"
266
+ self.TKEntry.configure(show=pwd_char)
267
+ else:
268
+ self.pwd_char = pwd_char = ""
269
+ self.TKEntry.configure(show=pwd_char)
270
+ if font is not None:
271
+ self.TKEntry.configure(font=font)
272
+
273
+ def set_ibeam_color(self, ibeam_color=None):
274
+ """
275
+ Sets the color of the I-Beam that is used to "insert" characters. This is oftens called a "Cursor" by
276
+ many users. To keep from being confused with tkinter's definition of cursor (the mouse pointer), the term
277
+ ibeam is used in this case.
278
+ :param ibeam_color: color to set the "I-Beam" used to indicate where characters will be inserted
279
+ :type ibeam_color: (str)
280
+ """
281
+
282
+ if not self._widget_was_created():
283
+ return
284
+ if ibeam_color is not None:
285
+ try:
286
+ self.Widget.config(insertbackground=ibeam_color)
287
+ except Exception:
288
+ _error_popup_with_traceback(
289
+ 'Error setting I-Beam color in set_ibeam_color',
290
+ 'The element has a action:',
291
+ self.Key,
292
+ 'The color passed in was:',
293
+ ibeam_color,
294
+ )
295
+
296
+ def get(self):
297
+ """
298
+ Read and return the current value of the input element. Must call `Window.Read` or `Window.Finalize` prior
299
+
300
+ :return: current value of Input field or '' if error encountered
301
+ :rtype: (str)
302
+ """
303
+ try:
304
+ text = self.TKStringVar.get()
305
+ except:
306
+ text = ''
307
+ return text
308
+
309
+ Get = get
310
+ Change = badlo