ttkbootstrap 1.13.2.dev0__tar.gz → 1.13.3__tar.gz

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 (39) hide show
  1. {ttkbootstrap-1.13.2.dev0/src/ttkbootstrap.egg-info → ttkbootstrap-1.13.3}/PKG-INFO +1 -1
  2. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/pyproject.toml +1 -1
  3. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkbootstrap/dialogs/colorchooser.py +21 -21
  4. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkbootstrap/dialogs/dialogs.py +5 -5
  5. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkbootstrap/localization/msgs.py +102 -0
  6. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkbootstrap/scrolled.py +5 -0
  7. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkbootstrap/tooltip.py +8 -2
  8. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkbootstrap/widgets.py +4 -0
  9. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkbootstrap/window.py +42 -31
  10. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3/src/ttkbootstrap.egg-info}/PKG-INFO +1 -1
  11. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/LICENSE +0 -0
  12. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/MANIFEST.in +0 -0
  13. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/README.md +0 -0
  14. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/README_zh.md +0 -0
  15. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/setup.cfg +0 -0
  16. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkbootstrap/__init__.py +0 -0
  17. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkbootstrap/__main__.py +0 -0
  18. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkbootstrap/colorutils.py +0 -0
  19. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkbootstrap/constants.py +0 -0
  20. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkbootstrap/dialogs/__init__.py +0 -0
  21. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkbootstrap/dialogs/colordropper.py +0 -0
  22. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkbootstrap/icons.py +0 -0
  23. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkbootstrap/localization/__init__.py +0 -0
  24. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkbootstrap/localization/msgcat.py +0 -0
  25. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkbootstrap/publisher.py +0 -0
  26. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkbootstrap/style.py +0 -0
  27. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkbootstrap/tableview.py +0 -0
  28. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkbootstrap/themes/__init__.py +0 -0
  29. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkbootstrap/themes/standard.py +0 -0
  30. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkbootstrap/themes/user.py +0 -0
  31. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkbootstrap/toast.py +0 -0
  32. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkbootstrap/utility.py +0 -0
  33. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkbootstrap/validation.py +0 -0
  34. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkbootstrap.egg-info/SOURCES.txt +0 -0
  35. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkbootstrap.egg-info/dependency_links.txt +0 -0
  36. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkbootstrap.egg-info/requires.txt +0 -0
  37. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkbootstrap.egg-info/top_level.txt +0 -0
  38. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkcreator/__init__.py +0 -0
  39. {ttkbootstrap-1.13.2.dev0 → ttkbootstrap-1.13.3}/src/ttkcreator/__main__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ttkbootstrap
3
- Version: 1.13.2.dev0
3
+ Version: 1.13.3
4
4
  Summary: A supercharged theme extension for tkinter that enables on-demand modern flat style themes inspired by Bootstrap.
5
5
  Author-email: Israel Dryer <israel.dryer@gmail.com>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ttkbootstrap"
7
- version = "1.13.2.dev0"
7
+ version = "1.13.3"
8
8
  description = "A supercharged theme extension for tkinter that enables on-demand modern flat style themes inspired by Bootstrap."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -35,8 +35,8 @@ def validate_color(event):
35
35
 
36
36
  class ColorChooser(ttk.Frame):
37
37
  """A class which creates a color chooser widget
38
-
39
- ![](../../assets/dialogs/querybox-get-color.png)
38
+
39
+ ![](../../assets/dialogs/querybox-get-color.png)
40
40
  """
41
41
 
42
42
  def __init__(self, master, initialcolor=None, padding=None):
@@ -57,7 +57,7 @@ class ColorChooser(ttk.Frame):
57
57
  r, g, b = ImageColor.getrgb(self.initialcolor)
58
58
  h, s, l = colorutils.color_to_hsl((r, g, b), RGB)
59
59
  hx = colorutils.color_to_hex((r, g, b), RGB)
60
-
60
+
61
61
  self.hue = ttk.IntVar(value=h)
62
62
  self.sat = ttk.IntVar(value=s)
63
63
  self.lum = ttk.IntVar(value=l)
@@ -117,7 +117,7 @@ class ColorChooser(ttk.Frame):
117
117
  return canvas
118
118
 
119
119
  def create_spectrum_indicator(self):
120
- """Create a square indicator that displays in the position of
120
+ """Create a square indicator that displays in the position of
121
121
  the selected color"""
122
122
  s = utility.scale_size(self, 10)
123
123
  width = utility.scale_size(self, 2)
@@ -207,7 +207,7 @@ class ColorChooser(ttk.Frame):
207
207
  autostyle=False,
208
208
  width=7
209
209
  ).pack(anchor=NW)
210
-
210
+
211
211
  # the frame and label for the new color
212
212
  self.preview = tkFrame(
213
213
  master=container,
@@ -297,7 +297,7 @@ class ColorChooser(ttk.Frame):
297
297
  func=lambda _, w=ent_hex: self.on_entry_value_change(
298
298
  w, HEX),
299
299
  add="+"
300
- )
300
+ )
301
301
 
302
302
  return container
303
303
 
@@ -342,7 +342,7 @@ class ColorChooser(ttk.Frame):
342
342
  self.luminance_scale.tag_lower(tag)
343
343
 
344
344
  def coords_from_color(self, hexcolor):
345
- """Get the coordinates on the color spectrum from the color
345
+ """Get the coordinates on the color spectrum from the color
346
346
  value"""
347
347
  h, s, _ = colorutils.color_to_hsl(hexcolor)
348
348
  x = (h / HUE) * self.spectrum_width
@@ -350,7 +350,7 @@ class ColorChooser(ttk.Frame):
350
350
  return x, y
351
351
 
352
352
  def color_from_coords(self, x, y):
353
- """Get the color value from the mouse position in the color
353
+ """Get the color value from the mouse position in the color
354
354
  spectrum"""
355
355
  HEIGHT = self.spectrum_height
356
356
  WIDTH = self.spectrum_width
@@ -372,7 +372,7 @@ class ColorChooser(ttk.Frame):
372
372
  self.hex.set(hx)
373
373
 
374
374
  def get_variables(self):
375
- """Get the values of all color models and return a
375
+ """Get the values of all color models and return a
376
376
  tuple of color values"""
377
377
  h = self.hue.get()
378
378
  s = self.sat.get()
@@ -431,7 +431,7 @@ class ColorChooser(ttk.Frame):
431
431
  # color events
432
432
  def sync_color_values(self, model):
433
433
  """Callback for when a color value changes. A change in one
434
- value will automatically update the other values so that all
434
+ value will automatically update the other values so that all
435
435
  color models remain in sync."""
436
436
  values = self.get_variables()
437
437
  if model == HEX:
@@ -451,7 +451,7 @@ class ColorChooser(ttk.Frame):
451
451
  self.update_luminance_indicator()
452
452
 
453
453
  def on_entry_value_change(self, widget: ttk.Spinbox, model):
454
- """Update the widget colors when the color value input is
454
+ """Update the widget colors when the color value input is
455
455
  changed"""
456
456
  is_valid = widget.validate()
457
457
  if is_valid:
@@ -496,8 +496,8 @@ class ColorChooserDialog(Dialog):
496
496
  hex. These values can be accessed by indexing the tuple or by using
497
497
  the named fields.
498
498
 
499
- ![](../../assets/dialogs/querybox-get-color.png)
500
-
499
+ ![](../../assets/dialogs/querybox-get-color.png)
500
+
501
501
  Examples:
502
502
 
503
503
  ```python
@@ -528,15 +528,15 @@ class ColorChooserDialog(Dialog):
528
528
 
529
529
  def create_buttonbox(self, master):
530
530
  frame = ttk.Frame(master, padding=(5, 5))
531
-
531
+
532
532
  # OK button
533
- ok = ttk.Button(frame, bootstyle=PRIMARY, width=6, text=MessageCatalog.translate('OK'))
533
+ ok = ttk.Button(frame, bootstyle=PRIMARY, text=MessageCatalog.translate('OK'))
534
534
  ok.bind("<Return>", lambda _: ok.invoke())
535
535
  ok.configure(command=lambda b=ok: self.on_button_press(b))
536
536
  ok.pack(padx=2, side=RIGHT)
537
537
 
538
538
  # Cancel button
539
- cancel = ttk.Button(frame, bootstyle=SECONDARY, width=6, text=MessageCatalog.translate('Cancel'))
539
+ cancel = ttk.Button(frame, bootstyle=SECONDARY, text=MessageCatalog.translate('Cancel'))
540
540
  cancel.bind("<Return>", lambda _: cancel.invoke())
541
541
  cancel.configure(command=lambda b=cancel: self.on_button_press(b))
542
542
  cancel.pack(padx=2, side=RIGHT)
@@ -547,7 +547,7 @@ class ColorChooserDialog(Dialog):
547
547
  ToolTip(dropper, MessageCatalog.translate('color dropper')) # add tooltip
548
548
  dropper.pack(side=RIGHT, padx=2)
549
549
  dropper.bind("<Button-1>", self.on_show_colordropper)
550
-
550
+
551
551
  frame.pack(side=BOTTOM, fill=X, anchor=S)
552
552
 
553
553
  def on_show_colordropper(self, event):
@@ -562,9 +562,9 @@ class ColorChooserDialog(Dialog):
562
562
  if button.cget('text') == 'OK':
563
563
  values = self.colorchooser.get_variables()
564
564
  self._result = ColorChoice(
565
- rgb=(values.r, values.g, values.b),
566
- hsl=(values.h, values.s, values.l),
565
+ rgb=(values.r, values.g, values.b),
566
+ hsl=(values.h, values.s, values.l),
567
567
  hex=values.hex
568
568
  )
569
- self._toplevel.destroy()
570
- self._toplevel.destroy()
569
+ self._toplevel.destroy()
570
+ self._toplevel.destroy()
@@ -1,6 +1,6 @@
1
1
  """
2
- This module contains various base dialog base classes that can be
3
- used to create custom dialogs for the end user.
2
+ This module contains various base dialog base classes that can be
3
+ used to create custom dialogs for the end user.
4
4
 
5
5
  These classes serve as the basis for the pre-defined static helper
6
6
  methods in the `Messagebox`, and `Querybox` container classes.
@@ -86,8 +86,6 @@ class Dialog(BaseWidget):
86
86
  if self._initial_focus:
87
87
  self._initial_focus.focus_force()
88
88
 
89
- self._toplevel.grab_set()
90
- self._toplevel.wait_window()
91
89
 
92
90
  def create_body(self, master):
93
91
  """Create the dialog body.
@@ -354,7 +352,7 @@ class MessageDialog(Dialog):
354
352
  command = self._command
355
353
  if command is not None:
356
354
  command()
357
- self._toplevel.destroy()
355
+ self._toplevel.after_idle(self._toplevel.destroy)
358
356
 
359
357
  def show(self, position=None):
360
358
  """Create and display the popup messagebox."""
@@ -1158,6 +1156,7 @@ class FontDialog(Dialog):
1158
1156
  slant = self._slant.get()
1159
1157
  overstrike = self._overstrike.get()
1160
1158
  underline = self._underline.get()
1159
+ weight = self._weight.get()
1161
1160
 
1162
1161
  self._preview_font.config(
1163
1162
  family=family,
@@ -1165,6 +1164,7 @@ class FontDialog(Dialog):
1165
1164
  slant=slant,
1166
1165
  overstrike=overstrike,
1167
1166
  underline=underline,
1167
+ weight=weight,
1168
1168
  )
1169
1169
  try:
1170
1170
  self._preview_text.configure(font=self._preview_font)
@@ -725,3 +725,105 @@ MESSAGES.append(
725
725
  ("Yes", "確認"),
726
726
  )
727
727
  )
728
+
729
+ MESSAGES.append(
730
+ # Dutch translation (nl, nl_nl, nl_be)
731
+ LocaleMsgs(
732
+ "nl",
733
+ ("OK", "OK"),
734
+ ("Ok", "Ok"),
735
+ ("Continue", "Verder"),
736
+ ("Retry", "Herhalen"),
737
+ ("Delete", "Verwijderen"),
738
+ ("Next", "Volgende"),
739
+ ("Prev", "Vorige"),
740
+ ("Yes", "Ja"),
741
+ ("No", "Nee"),
742
+ ("Open", "Openen"),
743
+ ("Close", "Sluiten"),
744
+ ("Add", "Toevoegen"),
745
+ ("Remove", "Verwijderen"),
746
+ ("Submit", "OK"),
747
+ ("Family", "Familie"),
748
+ ("Weight", "Gewicht"),
749
+ ("Slant", "Cursief"),
750
+ ("Effects", "Effect"),
751
+ ("Preview", "Voorbeeld"),
752
+ ("Size", "Grootte"),
753
+ ("Should be a of data type", "Moet zijn van type"),
754
+ ("Invalid data type", "Verkeerd type"),
755
+ ("Number cannot be greater than", "Nummer kan niet groter zijn dan"),
756
+ ("Out of range", "Buiten bereik"),
757
+ ("Previous", "Vorige"),
758
+ ("The quick brown fox jumps over the lazy dog.",
759
+ "The quick brown fox jumps over the lazy dog.\n"
760
+ "Filmquiz bracht knappe ex-yogi van de wijs.\n"
761
+ "Pa's wijze lynx bezag vroom het fikse aquaduct."),
762
+ ("Font Selector", "Lettertypekeuze"),
763
+ ("normal", "normaal"),
764
+ ("bold", "vet"),
765
+ ("negrito", "zwart"),
766
+ ("roman", "normaal"),
767
+ ("italic", "cursief"),
768
+ ("underline", "onderstreept"),
769
+ ("overstrike", "doorhalen"),
770
+ ("Color Chooser", "Kleurkeuze"),
771
+ ("Advanced", "Geavanceerd"),
772
+ ("Themed", "Thema"),
773
+ ("Standard", "Standaard"),
774
+ ("Current", "Huidig"),
775
+ ("New", "Nieuw"),
776
+ ("Hue", "Tint"),
777
+ ("Sat", "Verzadiging"),
778
+ ("Lum", "Helderheid"),
779
+ ("Hex", "Hex"),
780
+ ("Red", "Rood"),
781
+ ("Green", "Groen"),
782
+ ("Blue", "Blauw"),
783
+ ("color dropper", "Kleurenkiezer"),
784
+ ("Cancel", "Annuleren"),
785
+ ("Search", "Zoeken"),
786
+ ("Page", "Pagina"),
787
+ ("of", "van"),
788
+ ("⎌", "⎌"),
789
+ ("Reset table", "Tabel resetten"),
790
+ ("Columns", "Kolommen"),
791
+ ("Move", "Verplaatsen"),
792
+ ("Align", "Uitlijnen"),
793
+ ("Hide column", "Kolom verbergen"),
794
+ ("Delete column", "Kolom verwijderen"),
795
+ ("Show All", "Alle tonen"),
796
+ ("Move to left", "Verplaats naar links"),
797
+ ("Move to right", "Verplaats naar rechts"),
798
+ ("Move to first", "Verplaats naar begin"),
799
+ ("Move to last", "Verplaats naar eind"),
800
+ ("Align left", "Links uitlijnen"),
801
+ ("Align center", "Centreren"),
802
+ ("Align right", "Rechts uitlijnen"),
803
+ ("Sort", "Sorteren"),
804
+ ("Filter", "Filteren"),
805
+ ("Export", "Exporteren"),
806
+ ("Delete selected rows", "Verwijder geselecteerde rijen"),
807
+ ("Sort Ascending", "Sorteer oplopend"),
808
+ ("Sort Descending", "Sorteer aflopend"),
809
+ ("Clear filters", "Filters wissen"),
810
+ ("Filter by cell's value", "Filteren op celinhoud"),
811
+ ("Hide select rows", "Rijen verbergen"),
812
+ ("Show only select rows", "Alleen geselecteerde rijen weergeven"),
813
+ ("Export all records", "Alle data exporteren"),
814
+ ("Export current page", "Huidige pagina exporteren"),
815
+ ("Export current selection", "Huidge selectie exporteren"),
816
+ ("Export records in filter", "Alle gefilterde data exporteren"),
817
+ ("Move up", "Naar boven"),
818
+ ("Move down", "Naar beneden"),
819
+ ("Move to top", "Naar het begin"),
820
+ ("Move to bottom", "Naar het eind"),
821
+ ("Mo", "Ma"),
822
+ ("Tu", "Di"),
823
+ ("We", "Wo"),
824
+ ("Th", "Do"),
825
+ ("Fr", "Vr"),
826
+ ("Sa", "Za"),
827
+ ("Su", "Zo"),
828
+ )
829
+ )
@@ -427,6 +427,11 @@ class ScrolledFrame(ttk.Frame):
427
427
  frame."""
428
428
  self.autohide = not self.autohide
429
429
 
430
+ def destroy(self):
431
+ self.vscroll.destroy()
432
+ super().destroy()
433
+ self.container.destroy()
434
+
430
435
  def _measures(self):
431
436
  """Measure the base size of the container and the thumb size
432
437
  for use in the yview methods"""
@@ -33,13 +33,14 @@ class ToolTip:
33
33
  ToolTip(b2, text="This is dangerous", bootstyle=(DANGER, INVERSE))
34
34
 
35
35
  app.mainloop()
36
- ```
36
+ ```
37
37
  """
38
38
 
39
39
  def __init__(
40
40
  self,
41
41
  widget,
42
42
  text="widget info",
43
+ padding=10,
43
44
  justify: Literal["left", "center", "right"] = "left",
44
45
  bootstyle=None,
45
46
  wraplength=None,
@@ -57,6 +58,9 @@ class ToolTip:
57
58
  text (str):
58
59
  The text to display in the tooltip window.
59
60
 
61
+ padding (int):
62
+ The padding between the text and the border of the tooltip (default=10).
63
+
60
64
  bootstyle (str):
61
65
  The style to apply to the tooltip label. You can use
62
66
  any of the standard ttkbootstrap label styles.
@@ -71,6 +75,7 @@ class ToolTip:
71
75
  """
72
76
  self.widget = widget
73
77
  self.text = text
78
+ self.padding = padding
74
79
  self.justify = justify
75
80
  self.image = image
76
81
  self.bootstyle = bootstyle
@@ -82,6 +87,7 @@ class ToolTip:
82
87
  # set keyword arguments
83
88
  kwargs["overrideredirect"] = True
84
89
  kwargs["master"] = self.widget
90
+ kwargs["windowtype"] = "tooltip"
85
91
  if "alpha" not in kwargs:
86
92
  kwargs["alpha"] = 0.95
87
93
  self.toplevel_kwargs = kwargs
@@ -136,7 +142,7 @@ class ToolTip:
136
142
  compound='bottom',
137
143
  justify=self.justify,
138
144
  wraplength=self.wraplength,
139
- padding=10,
145
+ padding=self.padding,
140
146
  )
141
147
  lbl.pack(fill=BOTH, expand=YES)
142
148
  if self.bootstyle:
@@ -76,6 +76,9 @@ class DateEntry(ttk.Frame):
76
76
  When pressed, a date chooser popup is displayed. The returned
77
77
  value is inserted into the combobox.
78
78
 
79
+ The <<DateEntrySelected>> event is generated when a date is
80
+ selected.
81
+
79
82
  The date chooser popup will use the date in the combobox as the
80
83
  date of focus if it is in the format specified by the
81
84
  `dateformat` parameter. By default, this format is "%Y-%m-%d".
@@ -249,6 +252,7 @@ class DateEntry(ttk.Frame):
249
252
  self.entry.delete(first=0, last=tk.END)
250
253
  self.entry.insert(tk.END, new_date.strftime(self._dateformat))
251
254
  self.entry.focus_force()
255
+ self.event_generate("<<DateEntrySelected>>")
252
256
 
253
257
 
254
258
  class Floodgauge(tk.Canvas):
@@ -1,5 +1,5 @@
1
1
  """
2
- This module contains a class of the same name that wraps the
2
+ This module contains a class of the same name that wraps the
3
3
  tkinter.Tk and ttkbootstrap.style.Style classes to provide a more
4
4
  consolidated api for initial application startup.
5
5
  """
@@ -29,14 +29,14 @@ def apply_class_bindings(window: tkinter.Widget):
29
29
  """Add class level event bindings in application"""
30
30
  for className in ["TEntry", "TSpinbox", "TCombobox", "Text"]:
31
31
  window.bind_class(
32
- className=className,
33
- sequence="<Configure>",
32
+ className=className,
33
+ sequence="<Configure>",
34
34
  func=on_disabled_readonly_state,
35
35
  add="+")
36
36
 
37
37
  for sequence in ["<Control-a>", "<Control-A>"]:
38
38
  window.bind_class(
39
- className=className,
39
+ className=className,
40
40
  sequence=sequence,
41
41
  func=on_select_all)
42
42
 
@@ -62,8 +62,16 @@ def apply_all_bindings(window: tkinter.Widget):
62
62
  window.bind_all('<Destroy>', lambda e: Publisher.unsubscribe(e.widget))
63
63
 
64
64
 
65
+ def on_visibility(event):
66
+ """Set Window or Toplevel alpha value on Visibility (X11)"""
67
+ widget = event.widget
68
+ if isinstance(widget, (Window, Toplevel)) and widget.alpha_bind:
69
+ widget.unbind(widget.alpha_bind)
70
+ widget.attributes("-alpha", widget.alpha)
71
+
72
+
65
73
  def on_disabled_readonly_state(event):
66
- """Change the cursor of entry type widgets to 'arrow' if in a
74
+ """Change the cursor of entry type widgets to 'arrow' if in a
67
75
  disabled or readonly state."""
68
76
  try:
69
77
  widget = event.widget
@@ -108,7 +116,7 @@ def on_select_all(event):
108
116
  else:
109
117
  widget.select_range(0, END)
110
118
  widget.icursor(END)
111
- return 'break'
119
+ return 'break'
112
120
 
113
121
 
114
122
  class Window(tkinter.Tk):
@@ -251,39 +259,40 @@ class Window(tkinter.Tk):
251
259
  if size is not None:
252
260
  width, height = size
253
261
  self.geometry(f"{width}x{height}")
254
-
262
+
255
263
  if position is not None:
256
264
  xpos, ypos = position
257
265
  self.geometry(f"+{xpos}+{ypos}")
258
-
266
+
259
267
  if minsize is not None:
260
268
  width, height = minsize
261
269
  self.minsize(width, height)
262
-
270
+
263
271
  if maxsize is not None:
264
272
  width, height = maxsize
265
273
  self.maxsize(width, height)
266
-
274
+
267
275
  if resizable is not None:
268
276
  width, height = resizable
269
277
  self.resizable(width, height)
270
-
271
- if alpha is not None:
272
- if self.winsys == 'x11':
273
- self.wait_visibility(self)
274
- self.attributes("-alpha", alpha)
275
-
278
+
276
279
  if transient is not None:
277
280
  self.transient(transient)
278
-
281
+
279
282
  if overrideredirect:
280
283
  self.overrideredirect(1)
281
284
 
285
+ if alpha is not None:
286
+ if self.winsys == 'x11':
287
+ self.alpha = alpha
288
+ self.alpha_bind = self.bind("<Visibility>", on_visibility, '+')
289
+ else:
290
+ self.attributes("-alpha", alpha)
291
+
282
292
  apply_class_bindings(self)
283
293
  apply_all_bindings(self)
284
294
  self._style = Style(themename)
285
295
 
286
-
287
296
  @property
288
297
  def style(self):
289
298
  """Return a reference to the `ttkbootstrap.style.Style` object."""
@@ -444,11 +453,11 @@ class Toplevel(tkinter.Toplevel):
444
453
  if position is not None:
445
454
  xpos, ypos = position
446
455
  self.geometry(f"+{xpos}+{ypos}")
447
-
456
+
448
457
  if minsize is not None:
449
458
  width, height = minsize
450
459
  self.minsize(width, height)
451
-
460
+
452
461
  if maxsize is not None:
453
462
  width, height = maxsize
454
463
  self.maxsize(width, height)
@@ -456,32 +465,34 @@ class Toplevel(tkinter.Toplevel):
456
465
  if resizable is not None:
457
466
  width, height = resizable
458
467
  self.resizable(width, height)
459
-
460
- if alpha is not None:
461
- if self.winsys == 'x11':
462
- self.wait_visibility(self)
463
- self.attributes("-alpha", alpha)
464
-
468
+
465
469
  if iconify:
466
470
  self.iconify()
467
-
471
+
468
472
  if transient is not None:
469
473
  self.transient(transient)
470
-
474
+
471
475
  if overrideredirect:
472
476
  self.overrideredirect(1)
473
-
477
+
474
478
  if windowtype is not None:
475
479
  if self.winsys == 'x11':
476
480
  self.attributes("-type", windowtype)
477
-
481
+
478
482
  if topmost:
479
483
  self.attributes("-topmost", 1)
480
-
484
+
481
485
  if toolwindow:
482
486
  if self.winsys == 'win32':
483
487
  self.attributes("-toolwindow", 1)
484
488
 
489
+ if alpha is not None:
490
+ if self.winsys == 'x11':
491
+ self.alpha = alpha
492
+ self.alpha_bind = self.bind("<Visibility>", on_visibility, '+')
493
+ else:
494
+ self.attributes("-alpha", alpha)
495
+
485
496
  @property
486
497
  def style(self):
487
498
  """Return a reference to the `ttkbootstrap.style.Style` object."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ttkbootstrap
3
- Version: 1.13.2.dev0
3
+ Version: 1.13.3
4
4
  Summary: A supercharged theme extension for tkinter that enables on-demand modern flat style themes inspired by Bootstrap.
5
5
  Author-email: Israel Dryer <israel.dryer@gmail.com>
6
6
  License: MIT