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.
- KL_Py/KL_Py.py +4400 -0
- KL_Py/__init__.py +1 -0
- KL_Py/hindGui/__init__.py +16529 -0
- KL_Py/hindGui/_utils.py +140 -0
- KL_Py/hindGui/elements/base.py +1055 -0
- KL_Py/hindGui/elements/button.py +947 -0
- KL_Py/hindGui/elements/calendar.py +222 -0
- KL_Py/hindGui/elements/canvas.py +122 -0
- KL_Py/hindGui/elements/center.py +44 -0
- KL_Py/hindGui/elements/checkbox.py +240 -0
- KL_Py/hindGui/elements/column.py +443 -0
- KL_Py/hindGui/elements/combo.py +329 -0
- KL_Py/hindGui/elements/error.py +47 -0
- KL_Py/hindGui/elements/frame.py +273 -0
- KL_Py/hindGui/elements/graph.py +817 -0
- KL_Py/hindGui/elements/helpers.py +202 -0
- KL_Py/hindGui/elements/image.py +324 -0
- KL_Py/hindGui/elements/input.py +310 -0
- KL_Py/hindGui/elements/list_box.py +392 -0
- KL_Py/hindGui/elements/menu.py +192 -0
- KL_Py/hindGui/elements/multiline.py +685 -0
- KL_Py/hindGui/elements/option_menu.py +168 -0
- KL_Py/hindGui/elements/pane.py +127 -0
- KL_Py/hindGui/elements/progress_bar.py +304 -0
- KL_Py/hindGui/elements/radio.py +252 -0
- KL_Py/hindGui/elements/separator.py +64 -0
- KL_Py/hindGui/elements/sizegrip.py +34 -0
- KL_Py/hindGui/elements/slider.py +199 -0
- KL_Py/hindGui/elements/spin.py +252 -0
- KL_Py/hindGui/elements/status_bar.py +165 -0
- KL_Py/hindGui/elements/stretch.py +26 -0
- KL_Py/hindGui/elements/tab.py +697 -0
- KL_Py/hindGui/elements/table.py +463 -0
- KL_Py/hindGui/elements/text.py +413 -0
- KL_Py/hindGui/elements/tree.py +493 -0
- KL_Py/hindGui/replace.py +45 -0
- KL_Py/hindGui/tray.py +358 -0
- KL_Py/hindGui/window.py +2906 -0
- KL_Py/requests/__init__.py +184 -0
- KL_Py/requests/__version__.py +14 -0
- KL_Py/requests/_internal_utils.py +50 -0
- KL_Py/requests/adapters.py +719 -0
- KL_Py/requests/api.py +157 -0
- KL_Py/requests/auth.py +314 -0
- KL_Py/requests/certifi/__init__.py +4 -0
- KL_Py/requests/certifi/__main__.py +12 -0
- KL_Py/requests/certifi/core.py +83 -0
- KL_Py/requests/certifi/py.typed +0 -0
- KL_Py/requests/certs.py +17 -0
- KL_Py/requests/charset_normalizer/__init__.py +48 -0
- KL_Py/requests/charset_normalizer/__main__.py +6 -0
- KL_Py/requests/charset_normalizer/api.py +671 -0
- KL_Py/requests/charset_normalizer/cd.py +421 -0
- KL_Py/requests/charset_normalizer/cli/__init__.py +8 -0
- KL_Py/requests/charset_normalizer/cli/__main__.py +363 -0
- KL_Py/requests/charset_normalizer/constant.py +2031 -0
- KL_Py/requests/charset_normalizer/legacy.py +80 -0
- KL_Py/requests/charset_normalizer/md.py +744 -0
- KL_Py/requests/charset_normalizer/models.py +359 -0
- KL_Py/requests/charset_normalizer/py.typed +0 -0
- KL_Py/requests/charset_normalizer/utils.py +420 -0
- KL_Py/requests/charset_normalizer/version.py +8 -0
- KL_Py/requests/compat.py +106 -0
- KL_Py/requests/cookies.py +561 -0
- KL_Py/requests/exceptions.py +151 -0
- KL_Py/requests/help.py +134 -0
- KL_Py/requests/hooks.py +33 -0
- KL_Py/requests/idna/__init__.py +45 -0
- KL_Py/requests/idna/codec.py +122 -0
- KL_Py/requests/idna/compat.py +15 -0
- KL_Py/requests/idna/core.py +437 -0
- KL_Py/requests/idna/idnadata.py +4309 -0
- KL_Py/requests/idna/intranges.py +57 -0
- KL_Py/requests/idna/package_data.py +1 -0
- KL_Py/requests/idna/py.typed +0 -0
- KL_Py/requests/idna/uts46data.py +8841 -0
- KL_Py/requests/models.py +1039 -0
- KL_Py/requests/packages.py +23 -0
- KL_Py/requests/sessions.py +831 -0
- KL_Py/requests/status_codes.py +128 -0
- KL_Py/requests/structures.py +99 -0
- KL_Py/requests/urllib3/__init__.py +211 -0
- KL_Py/requests/urllib3/_base_connection.py +165 -0
- KL_Py/requests/urllib3/_collections.py +487 -0
- KL_Py/requests/urllib3/_request_methods.py +278 -0
- KL_Py/requests/urllib3/_version.py +34 -0
- KL_Py/requests/urllib3/connection.py +1099 -0
- KL_Py/requests/urllib3/connectionpool.py +1178 -0
- KL_Py/requests/urllib3/contrib/__init__.py +0 -0
- KL_Py/requests/urllib3/contrib/emscripten/__init__.py +17 -0
- KL_Py/requests/urllib3/contrib/emscripten/connection.py +260 -0
- KL_Py/requests/urllib3/contrib/emscripten/fetch.py +726 -0
- KL_Py/requests/urllib3/contrib/emscripten/request.py +22 -0
- KL_Py/requests/urllib3/contrib/emscripten/response.py +277 -0
- KL_Py/requests/urllib3/contrib/pyopenssl.py +564 -0
- KL_Py/requests/urllib3/contrib/socks.py +228 -0
- KL_Py/requests/urllib3/exceptions.py +335 -0
- KL_Py/requests/urllib3/fields.py +341 -0
- KL_Py/requests/urllib3/filepost.py +89 -0
- KL_Py/requests/urllib3/http2/__init__.py +53 -0
- KL_Py/requests/urllib3/http2/connection.py +356 -0
- KL_Py/requests/urllib3/http2/probe.py +87 -0
- KL_Py/requests/urllib3/poolmanager.py +651 -0
- KL_Py/requests/urllib3/py.typed +2 -0
- KL_Py/requests/urllib3/response.py +1480 -0
- KL_Py/requests/urllib3/util/__init__.py +42 -0
- KL_Py/requests/urllib3/util/connection.py +137 -0
- KL_Py/requests/urllib3/util/proxy.py +43 -0
- KL_Py/requests/urllib3/util/request.py +263 -0
- KL_Py/requests/urllib3/util/response.py +101 -0
- KL_Py/requests/urllib3/util/retry.py +549 -0
- KL_Py/requests/urllib3/util/ssl_.py +527 -0
- KL_Py/requests/urllib3/util/ssl_match_hostname.py +159 -0
- KL_Py/requests/urllib3/util/ssltransport.py +271 -0
- KL_Py/requests/urllib3/util/timeout.py +275 -0
- KL_Py/requests/urllib3/util/url.py +469 -0
- KL_Py/requests/urllib3/util/util.py +42 -0
- KL_Py/requests/urllib3/util/wait.py +124 -0
- KL_Py/requests/utils.py +1086 -0
- KL_Py/when.py +144 -0
- kl_py-0.0.1.dist-info/METADATA +15 -0
- kl_py-0.0.1.dist-info/RECORD +125 -0
- kl_py-0.0.1.dist-info/WHEEL +5 -0
- kl_py-0.0.1.dist-info/licenses/LICENSE +21 -0
- kl_py-0.0.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import tkinter as tk
|
|
4
|
+
|
|
5
|
+
import hindGui
|
|
6
|
+
from hindGui import ELEM_TYPE_INPUT_SPIN
|
|
7
|
+
from hindGui import Element
|
|
8
|
+
from hindGui._utils import _error_popup_with_traceback
|
|
9
|
+
from hindGui._utils import _exit_mainloop
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Spin(Element):
|
|
13
|
+
"""
|
|
14
|
+
A spinner with up/down buttons and a single line of text. Choose 1 values from list
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
def __init__(
|
|
18
|
+
self,
|
|
19
|
+
values,
|
|
20
|
+
initial_value=None,
|
|
21
|
+
disabled=False,
|
|
22
|
+
change_submits=False,
|
|
23
|
+
enable_events=False,
|
|
24
|
+
na_badla_jae=False,
|
|
25
|
+
size=(None, None),
|
|
26
|
+
s=(None, None),
|
|
27
|
+
auto_size_text=None,
|
|
28
|
+
bind_return_key=None,
|
|
29
|
+
font=None,
|
|
30
|
+
background_color=None,
|
|
31
|
+
text_color=None,
|
|
32
|
+
action=None,
|
|
33
|
+
k=None,
|
|
34
|
+
pad=None,
|
|
35
|
+
p=None,
|
|
36
|
+
wrap=None,
|
|
37
|
+
ke_upar=None,
|
|
38
|
+
right_click_menu=None,
|
|
39
|
+
expand_x=False,
|
|
40
|
+
expand_y=False,
|
|
41
|
+
nazar=True,
|
|
42
|
+
metadata=None,
|
|
43
|
+
):
|
|
44
|
+
"""
|
|
45
|
+
:param values: List of valid values
|
|
46
|
+
:type values: Tuple[Any] or List[Any]
|
|
47
|
+
:param initial_value: Initial item to show in window. Choose from list of values supplied
|
|
48
|
+
:type initial_value: (Any)
|
|
49
|
+
:param disabled: set disable state
|
|
50
|
+
:type disabled: (bool)
|
|
51
|
+
:param change_submits: DO NOT USE. Only listed for backwards compat - Use enable_events instead
|
|
52
|
+
:type change_submits: (bool)
|
|
53
|
+
:param enable_events: Turns on the element specific events. Spin events happen when an item changes
|
|
54
|
+
:type enable_events: (bool)
|
|
55
|
+
:param na_badla_jae: If True, then users cannot type in values. Only values from the values list are allowed.
|
|
56
|
+
:type na_badla_jae: (bool)
|
|
57
|
+
:param size: (w, h) w=characters-wide, h=rows-high. If an int instead of a tuple is supplied, then height is auto-set to 1
|
|
58
|
+
:type size: (int, int) | (None, None) | int
|
|
59
|
+
: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
|
|
60
|
+
:type s: (int, int) | (None, None) | int
|
|
61
|
+
:param auto_size_text: if True will size the element to match the length of the text
|
|
62
|
+
:type auto_size_text: (bool)
|
|
63
|
+
:param bind_return_key: If True, then the return action will cause a the element to generate an action when return action is pressed
|
|
64
|
+
:type bind_return_key: (bool)
|
|
65
|
+
:param font: specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike
|
|
66
|
+
:type font: (str or (str, int[, str]) or None)
|
|
67
|
+
:param background_color: color of background
|
|
68
|
+
:type background_color: (str)
|
|
69
|
+
:param text_color: color of the text
|
|
70
|
+
:type text_color: (str)
|
|
71
|
+
:param action: Used with window.find_element and with return values to uniquely identify this element
|
|
72
|
+
:type action: str | int | tuple | object
|
|
73
|
+
:param k: Same as the Key. You can use either k or action. Which ever is set will be used.
|
|
74
|
+
:type k: str | int | tuple | object
|
|
75
|
+
:param pad: Amount of padding to put around element in pixels (left/right, top/bottom) or ((left, right), (top, bottom)) or an int. If an int, then it's converted into a tuple (int, int)
|
|
76
|
+
:type pad: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int) | int
|
|
77
|
+
: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
|
|
78
|
+
:type p: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int) | int
|
|
79
|
+
:param wrap: Determines if the values should "Wrap". Default is False. If True, when reaching last value, will continue back to the first value.
|
|
80
|
+
:type wrap: (bool)
|
|
81
|
+
:param ke_upar: text, that will appear when mouse hovers over the element
|
|
82
|
+
:type ke_upar: (str)
|
|
83
|
+
: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.
|
|
84
|
+
:type right_click_menu: List[List[ List[str] | str ]]
|
|
85
|
+
:param expand_x: If True the element will automatically expand in the X direction to fill available space
|
|
86
|
+
:type expand_x: (bool)
|
|
87
|
+
:param expand_y: If True the element will automatically expand in the Y direction to fill available space
|
|
88
|
+
:type expand_y: (bool)
|
|
89
|
+
:param nazar: set visibility state of the element
|
|
90
|
+
:type nazar: (bool)
|
|
91
|
+
:param metadata: User metadata that can be set to ANYTHING
|
|
92
|
+
:type metadata: (Any)
|
|
93
|
+
"""
|
|
94
|
+
|
|
95
|
+
self.Values = values
|
|
96
|
+
self.DefaultValue = initial_value
|
|
97
|
+
self.ChangeSubmits = change_submits or enable_events
|
|
98
|
+
self.TKSpinBox = self.Widget = None # type: tk.Spinbox
|
|
99
|
+
self.Disabled = disabled
|
|
100
|
+
self.Readonly = na_badla_jae
|
|
101
|
+
self.RightClickMenu = right_click_menu
|
|
102
|
+
self.BindReturnKey = bind_return_key
|
|
103
|
+
self.wrap = wrap
|
|
104
|
+
|
|
105
|
+
bg = background_color if background_color else hindGui.DEFAULT_INPUT_ELEMENTS_COLOR
|
|
106
|
+
fg = text_color if text_color is not None else hindGui.DEFAULT_INPUT_TEXT_COLOR
|
|
107
|
+
action = action if action is not None else k
|
|
108
|
+
sz = size if size != (None, None) else s
|
|
109
|
+
pad = pad if pad is not None else p
|
|
110
|
+
self.expand_x = expand_x
|
|
111
|
+
self.expand_y = expand_y
|
|
112
|
+
|
|
113
|
+
super().__init__(
|
|
114
|
+
ELEM_TYPE_INPUT_SPIN,
|
|
115
|
+
size=sz,
|
|
116
|
+
auto_size_text=auto_size_text,
|
|
117
|
+
font=font,
|
|
118
|
+
background_color=bg,
|
|
119
|
+
text_color=fg,
|
|
120
|
+
action=action,
|
|
121
|
+
pad=pad,
|
|
122
|
+
ke_upar=ke_upar,
|
|
123
|
+
nazar=nazar,
|
|
124
|
+
metadata=metadata,
|
|
125
|
+
)
|
|
126
|
+
return
|
|
127
|
+
|
|
128
|
+
def badlo(self, value=None, values=None, disabled=None, na_badla_jae=None, nazar=None):
|
|
129
|
+
"""
|
|
130
|
+
Changes some of the settings for the Spin Element. Must call `Window.Read` or `Window.Finalize` prior
|
|
131
|
+
Note that the state can be in 3 states only.... enabled, disabled, na_badla_jae even
|
|
132
|
+
though more combinations are available. The easy way to remember is that if you
|
|
133
|
+
badlo the na_badla_jae parameter then you are enabling the element.
|
|
134
|
+
|
|
135
|
+
Changes will not be nazar in your window until you call window.read or window.refresh.
|
|
136
|
+
|
|
137
|
+
If you badlo visibility, your element may MOVE. If you want it to remain stationary, use the "layout helper"
|
|
138
|
+
function "pin" to ensure your element is "pinned" to that location in your layout so that it returns there
|
|
139
|
+
when made nazar.
|
|
140
|
+
|
|
141
|
+
:param value: set the current value from list of choices
|
|
142
|
+
:type value: (Any)
|
|
143
|
+
:param values: set available choices
|
|
144
|
+
:type values: List[Any]
|
|
145
|
+
:param disabled: disable. Note disabled and na_badla_jae cannot be mixed. It must be one OR the other
|
|
146
|
+
:type disabled: (bool)
|
|
147
|
+
:param na_badla_jae: make element na_badla_jae. Note disabled and na_badla_jae cannot be mixed. It must be one OR the other
|
|
148
|
+
:type na_badla_jae: (bool)
|
|
149
|
+
:param nazar: control visibility of element
|
|
150
|
+
:type nazar: (bool)
|
|
151
|
+
"""
|
|
152
|
+
|
|
153
|
+
if not self._widget_was_created(): # if widget hasn't been created yet, then don't allow
|
|
154
|
+
return
|
|
155
|
+
|
|
156
|
+
if self._this_elements_window_closed():
|
|
157
|
+
_error_popup_with_traceback('Error in Spin.badlo - The window was closed')
|
|
158
|
+
return
|
|
159
|
+
|
|
160
|
+
if values is not None:
|
|
161
|
+
old_value = self.TKStringVar.get()
|
|
162
|
+
self.Values = values
|
|
163
|
+
self.TKSpinBox.configure(values=values)
|
|
164
|
+
self.TKStringVar.set(old_value)
|
|
165
|
+
if value is not None:
|
|
166
|
+
try:
|
|
167
|
+
self.TKStringVar.set(value)
|
|
168
|
+
self.DefaultValue = value
|
|
169
|
+
except:
|
|
170
|
+
pass
|
|
171
|
+
|
|
172
|
+
if na_badla_jae is True:
|
|
173
|
+
self.Readonly = True
|
|
174
|
+
self.TKSpinBox['state'] = 'readonly'
|
|
175
|
+
elif na_badla_jae is False:
|
|
176
|
+
self.Readonly = False
|
|
177
|
+
self.TKSpinBox['state'] = 'normal'
|
|
178
|
+
if disabled is True:
|
|
179
|
+
self.TKSpinBox['state'] = 'disable'
|
|
180
|
+
elif disabled is False:
|
|
181
|
+
if self.Readonly:
|
|
182
|
+
self.TKSpinBox['state'] = 'readonly'
|
|
183
|
+
else:
|
|
184
|
+
self.TKSpinBox['state'] = 'normal'
|
|
185
|
+
self.Disabled = disabled if disabled is not None else self.Disabled
|
|
186
|
+
|
|
187
|
+
if nazar is False:
|
|
188
|
+
self._pack_forget_save_settings()
|
|
189
|
+
elif nazar is True:
|
|
190
|
+
self._pack_restore_settings()
|
|
191
|
+
if nazar is not None:
|
|
192
|
+
self._nazar = nazar
|
|
193
|
+
|
|
194
|
+
def _SpinChangedHandler(self, action):
|
|
195
|
+
"""
|
|
196
|
+
Callback function. Used internally only. Called by tkinter when Spinbox Widget changes. Results in Window.parh() call returning
|
|
197
|
+
|
|
198
|
+
:param action: passed in from tkinter
|
|
199
|
+
:type action:
|
|
200
|
+
"""
|
|
201
|
+
# first, get the results table built
|
|
202
|
+
if self.Key is not None:
|
|
203
|
+
self.ParentForm.LastButtonClicked = self.Key
|
|
204
|
+
else:
|
|
205
|
+
self.ParentForm.LastButtonClicked = ''
|
|
206
|
+
self.ParentForm.FormRemainedOpen = True
|
|
207
|
+
_exit_mainloop(self.ParentForm)
|
|
208
|
+
# if self.ParentForm.CurrentlyRunningMainloop:
|
|
209
|
+
# Window._window_that_exited = self.ParentForm
|
|
210
|
+
# self.ParentForm.TKroot.quit() # kick the users out of the mainloop
|
|
211
|
+
|
|
212
|
+
def set_ibeam_color(self, ibeam_color=None):
|
|
213
|
+
"""
|
|
214
|
+
Sets the color of the I-Beam that is used to "insert" characters. This is oftens called a "Cursor" by
|
|
215
|
+
many users. To keep from being confused with tkinter's definition of cursor (the mouse pointer), the term
|
|
216
|
+
ibeam is used in this case.
|
|
217
|
+
:param ibeam_color: color to set the "I-Beam" used to indicate where characters will be inserted
|
|
218
|
+
:type ibeam_color: (str)
|
|
219
|
+
"""
|
|
220
|
+
|
|
221
|
+
if not self._widget_was_created():
|
|
222
|
+
return
|
|
223
|
+
if ibeam_color is not None:
|
|
224
|
+
try:
|
|
225
|
+
self.Widget.config(insertbackground=ibeam_color)
|
|
226
|
+
except Exception:
|
|
227
|
+
_error_popup_with_traceback(
|
|
228
|
+
'Error setting I-Beam color in set_ibeam_color',
|
|
229
|
+
'The element has a action:',
|
|
230
|
+
self.Key,
|
|
231
|
+
'The color passed in was:',
|
|
232
|
+
ibeam_color,
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
def get(self):
|
|
236
|
+
"""
|
|
237
|
+
Return the current chosen value showing in spinbox.
|
|
238
|
+
This value will be the same as what was provided as list of choices. If list items are ints, then the
|
|
239
|
+
item returned will be an int (not a string)
|
|
240
|
+
|
|
241
|
+
:return: The currently nazar entry
|
|
242
|
+
:rtype: (Any)
|
|
243
|
+
"""
|
|
244
|
+
value = self.TKStringVar.get()
|
|
245
|
+
for v in self.Values:
|
|
246
|
+
if str(v) == value:
|
|
247
|
+
value = v
|
|
248
|
+
break
|
|
249
|
+
return value
|
|
250
|
+
|
|
251
|
+
Get = get
|
|
252
|
+
Change = badlo
|
|
@@ -0,0 +1,165 @@
|
|
|
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_STATUSBAR
|
|
8
|
+
from hindGui import Element
|
|
9
|
+
from hindGui import RELIEF_SUNKEN
|
|
10
|
+
from hindGui._utils import _error_popup_with_traceback
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class StatusBar(Element):
|
|
14
|
+
"""
|
|
15
|
+
A StatusBar Element creates the sunken text-filled strip at the bottom. Many Windows programs have this line
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
def __init__(
|
|
19
|
+
self,
|
|
20
|
+
text,
|
|
21
|
+
size=(None, None),
|
|
22
|
+
s=(None, None),
|
|
23
|
+
auto_size_text=None,
|
|
24
|
+
click_submits=None,
|
|
25
|
+
enable_events=True,
|
|
26
|
+
relief=RELIEF_SUNKEN,
|
|
27
|
+
font=None,
|
|
28
|
+
text_color=None,
|
|
29
|
+
background_color=None,
|
|
30
|
+
justification=None,
|
|
31
|
+
pad=None,
|
|
32
|
+
p=None,
|
|
33
|
+
action=None,
|
|
34
|
+
k=None,
|
|
35
|
+
right_click_menu=None,
|
|
36
|
+
expand_x=False,
|
|
37
|
+
expand_y=False,
|
|
38
|
+
ke_upar=None,
|
|
39
|
+
nazar=True,
|
|
40
|
+
metadata=None,
|
|
41
|
+
):
|
|
42
|
+
"""
|
|
43
|
+
:param text: Text that is to be displayed in the widget
|
|
44
|
+
:type text: (str)
|
|
45
|
+
:param size: (w, h) w=characters-wide, h=rows-high. If an int instead of a tuple is supplied, then height is auto-set to 1
|
|
46
|
+
:type size: (int, int) | (int, None) | int
|
|
47
|
+
: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
|
|
48
|
+
:type s: (int, int) | (None, None) | int
|
|
49
|
+
:param auto_size_text: True if size should fit the text length
|
|
50
|
+
:type auto_size_text: (bool)
|
|
51
|
+
:param click_submits: DO NOT USE. Only listed for backwards compat - Use enable_events instead
|
|
52
|
+
:type click_submits: (bool)
|
|
53
|
+
:param enable_events: Turns on the element specific events. StatusBar events occur when the bar is clicked
|
|
54
|
+
:type enable_events: (bool)
|
|
55
|
+
:param relief: relief style. Values are same as progress meter relief values. Can be a constant or a string: `RELIEF_RAISED RELIEF_SUNKEN RELIEF_FLAT RELIEF_RIDGE RELIEF_GROOVE RELIEF_SOLID`
|
|
56
|
+
:type relief: (enum)
|
|
57
|
+
:param font: specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike
|
|
58
|
+
:type font: (str or (str, int[, str]) or None)
|
|
59
|
+
:param text_color: color of the text
|
|
60
|
+
:type text_color: (str)
|
|
61
|
+
:param background_color: color of background
|
|
62
|
+
:type background_color: (str)
|
|
63
|
+
:param justification: how string should be aligned within space provided by size. Valid choices = `left`, `right`, `center`
|
|
64
|
+
:type justification: (str)
|
|
65
|
+
:param pad: Amount of padding to put around element in pixels (left/right, top/bottom) or ((left, right), (top, bottom)) or an int. If an int, then it's converted into a tuple (int, int)
|
|
66
|
+
:type pad: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int) | int
|
|
67
|
+
: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
|
|
68
|
+
:type p: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int) | int
|
|
69
|
+
:param action: Used with window.find_element and with return values to uniquely identify this element to uniquely identify this element
|
|
70
|
+
:type action: str | int | tuple | object
|
|
71
|
+
:param k: Same as the Key. You can use either k or action. Which ever is set will be used.
|
|
72
|
+
:type k: str | int | tuple | object
|
|
73
|
+
: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.
|
|
74
|
+
:type right_click_menu: List[List[ List[str] | str ]]
|
|
75
|
+
:param expand_x: If True the element will automatically expand in the X direction to fill available space
|
|
76
|
+
:type expand_x: (bool)
|
|
77
|
+
:param expand_y: If True the element will automatically expand in the Y direction to fill available space
|
|
78
|
+
:type expand_y: (bool)
|
|
79
|
+
:param ke_upar: text, that will appear when mouse hovers over the element
|
|
80
|
+
:type ke_upar: (str)
|
|
81
|
+
:param nazar: set visibility state of the element
|
|
82
|
+
:type nazar: (bool)
|
|
83
|
+
:param metadata: User metadata that can be set to ANYTHING
|
|
84
|
+
:type metadata: (Any)
|
|
85
|
+
"""
|
|
86
|
+
|
|
87
|
+
self.DisplayText = text
|
|
88
|
+
self.TextColor = text_color if text_color else hindGui.DEFAULT_TEXT_COLOR
|
|
89
|
+
self.Justification = justification
|
|
90
|
+
self.Relief = relief
|
|
91
|
+
self.ClickSubmits = click_submits or enable_events
|
|
92
|
+
if background_color is None:
|
|
93
|
+
bg = hindGui.DEFAULT_TEXT_ELEMENT_BACKGROUND_COLOR
|
|
94
|
+
else:
|
|
95
|
+
bg = background_color
|
|
96
|
+
self.TKText = self.Widget = None # type: tk.Label
|
|
97
|
+
action = action if action is not None else k
|
|
98
|
+
self.RightClickMenu = right_click_menu
|
|
99
|
+
sz = size if size != (None, None) else s
|
|
100
|
+
pad = pad if pad is not None else p
|
|
101
|
+
self.expand_x = expand_x
|
|
102
|
+
self.expand_y = expand_y
|
|
103
|
+
|
|
104
|
+
super().__init__(
|
|
105
|
+
ELEM_TYPE_STATUSBAR,
|
|
106
|
+
size=sz,
|
|
107
|
+
auto_size_text=auto_size_text,
|
|
108
|
+
background_color=bg,
|
|
109
|
+
font=font or hindGui.DEFAULT_FONT,
|
|
110
|
+
text_color=self.TextColor,
|
|
111
|
+
pad=pad,
|
|
112
|
+
action=action,
|
|
113
|
+
ke_upar=ke_upar,
|
|
114
|
+
nazar=nazar,
|
|
115
|
+
metadata=metadata,
|
|
116
|
+
)
|
|
117
|
+
return
|
|
118
|
+
|
|
119
|
+
def badlo(self, value=None, background_color=None, text_color=None, font=None, nazar=None):
|
|
120
|
+
"""
|
|
121
|
+
Changes some of the settings for the Status Bar Element. Must call `Window.Read` or `Window.Finalize` prior
|
|
122
|
+
|
|
123
|
+
Changes will not be nazar in your window until you call window.read or window.refresh.
|
|
124
|
+
|
|
125
|
+
If you badlo visibility, your element may MOVE. If you want it to remain stationary, use the "layout helper"
|
|
126
|
+
function "pin" to ensure your element is "pinned" to that location in your layout so that it returns there
|
|
127
|
+
when made nazar.
|
|
128
|
+
|
|
129
|
+
:param value: new text to show
|
|
130
|
+
:type value: (str)
|
|
131
|
+
:param background_color: color of background
|
|
132
|
+
:type background_color: (str)
|
|
133
|
+
:param text_color: color of the text
|
|
134
|
+
:type text_color: (str)
|
|
135
|
+
:param font: specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike
|
|
136
|
+
:type font: (str or (str, int[, str]) or None)
|
|
137
|
+
:param nazar: set visibility state of the element
|
|
138
|
+
:type nazar: (bool)
|
|
139
|
+
"""
|
|
140
|
+
|
|
141
|
+
if not self._widget_was_created(): # if widget hasn't been created yet, then don't allow
|
|
142
|
+
return
|
|
143
|
+
|
|
144
|
+
if self._this_elements_window_closed():
|
|
145
|
+
_error_popup_with_traceback('Error in StatusBar.badlo - The window was closed')
|
|
146
|
+
return
|
|
147
|
+
|
|
148
|
+
if value is not None:
|
|
149
|
+
self.DisplayText = value
|
|
150
|
+
stringvar = self.TKStringVar
|
|
151
|
+
stringvar.set(value)
|
|
152
|
+
if background_color not in (None, COLOR_SYSTEM_DEFAULT):
|
|
153
|
+
self.TKText.configure(background=background_color)
|
|
154
|
+
if text_color not in (None, COLOR_SYSTEM_DEFAULT):
|
|
155
|
+
self.TKText.configure(fg=text_color)
|
|
156
|
+
if font is not None:
|
|
157
|
+
self.TKText.configure(font=font)
|
|
158
|
+
if nazar is False:
|
|
159
|
+
self._pack_forget_save_settings()
|
|
160
|
+
elif nazar is True:
|
|
161
|
+
self._pack_restore_settings()
|
|
162
|
+
if nazar is not None:
|
|
163
|
+
self._nazar = nazar
|
|
164
|
+
|
|
165
|
+
Change = badlo
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from hindGui.elements.text import Text
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def Push(background_color=None):
|
|
7
|
+
"""
|
|
8
|
+
Acts like a Stretch element found in the Qt port.
|
|
9
|
+
Used in a Horizontal fashion. Placing one on each side of an element will enter the element.
|
|
10
|
+
Place one to the left and the element to the right will be right justified. See VStretch for vertical type
|
|
11
|
+
:param background_color: color of background may be needed because of how this is implemented
|
|
12
|
+
:type background_color: (str)
|
|
13
|
+
:return: (Text)
|
|
14
|
+
"""
|
|
15
|
+
return Text(font='_ 1', background_color=background_color, pad=(0, 0), expand_x=True)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def VPush(background_color=None):
|
|
19
|
+
"""
|
|
20
|
+
Acts like a Stretch element found in the Qt port.
|
|
21
|
+
Used in a Vertical fashion.
|
|
22
|
+
:param background_color: color of background may be needed because of how this is implemented
|
|
23
|
+
:type background_color: (str)
|
|
24
|
+
:return: (Text)
|
|
25
|
+
"""
|
|
26
|
+
return Text(font='_ 1', background_color=background_color, pad=(0, 0), expand_y=True)
|