CTkScrollableDropdownPP 2.1.3__tar.gz → 2.2__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.
@@ -10,7 +10,8 @@ class CTkScrollableDropdown(customtkinter.CTkToplevel):
10
10
  command=None, image_values=[], alpha: float = 0.95, frame_corner_radius=20, double_click=False,
11
11
  frame_border_color=None, text_color=None, autocomplete=False,
12
12
  hover_color=None, pagination: bool = True, items_per_page: int = 50,
13
- groups=None, font=("Segoe UI", 12), fade_in_duration: bool = True, fps: int = 60, **button_kwargs):
13
+ groups=None, font=("Segoe UI", 12), fade_in_duration: bool = True, fps: int = 60,
14
+ multiple: bool = False, **button_kwargs):
14
15
  super().__init__(master=attach.winfo_toplevel(), takefocus=1)
15
16
 
16
17
  self.group_patterns = None
@@ -43,6 +44,8 @@ class CTkScrollableDropdown(customtkinter.CTkToplevel):
43
44
  self.fps = max(1, int(fps))
44
45
  self.fade_animation_duration = 0.25
45
46
  self.animating = False
47
+ self.multiple = multiple
48
+ self.selected_values = []
46
49
 
47
50
  if groups is not None:
48
51
  for g in groups:
@@ -245,11 +248,18 @@ class CTkScrollableDropdown(customtkinter.CTkToplevel):
245
248
  self.current_page = 0
246
249
  self._init_buttons()
247
250
 
251
+ def _update_button_appearance(self, btn, value):
252
+ if self.multiple and value in self.selected_values:
253
+ btn.configure(fg_color=self.hover_color)
254
+ else:
255
+ btn.configure(fg_color=self.button_color)
256
+
248
257
  def update_buttons(self, values_list):
249
258
  for i, value in enumerate(values_list):
250
259
  if i in self.widgets:
251
260
  btn, _ = self.widgets[i]
252
261
  btn.configure(text=value, command=lambda v=value: self._attach_key_press(v), image=self.value_to_image.get(value))
262
+ self._update_button_appearance(btn, value)
253
263
  btn.pack(fill="x", pady=2, padx=(self.padding, 0))
254
264
  self.widgets[i][1] = True
255
265
  else:
@@ -265,6 +275,7 @@ class CTkScrollableDropdown(customtkinter.CTkToplevel):
265
275
  hover_color=self.hover_color,
266
276
  image=self.value_to_image.get(value)
267
277
  )
278
+ self._update_button_appearance(btn, value)
268
279
  btn.pack(fill="x", pady=2, padx=(self.padding, 0))
269
280
  self.widgets[i] = [btn, True]
270
281
  i = len(values_list)
@@ -423,8 +434,20 @@ class CTkScrollableDropdown(customtkinter.CTkToplevel):
423
434
  self.search_var.set("")
424
435
  self.event_generate("<<Selected>>")
425
436
  self.fade = True
426
- if self.command:
427
- self.command(k)
437
+ if self.multiple:
438
+ if k in self.selected_values:
439
+ self.selected_values.remove(k)
440
+ else:
441
+ self.selected_values.append(k)
442
+ for i, (btn, visible) in self.widgets.items():
443
+ if visible:
444
+ value = btn.cget("text")
445
+ self._update_button_appearance(btn, value)
446
+ if self.command:
447
+ self.command(self.selected_values)
448
+ else:
449
+ if self.command:
450
+ self.command(k)
428
451
  if hasattr(self, "search_var") and self.search_var.get().strip() != "":
429
452
  self.filtered_values = None
430
453
  self.current_page = 0
@@ -432,8 +455,9 @@ class CTkScrollableDropdown(customtkinter.CTkToplevel):
432
455
  if self.pagination:
433
456
  self.pagination_frame.pack(fill="x", side="bottom")
434
457
  self.fade = False
435
- self._animated_withdraw()
436
- self.hide_flag = True
458
+ if not self.multiple:
459
+ self._animated_withdraw()
460
+ self.hide_flag = True
437
461
 
438
462
  def live_update(self, string=None):
439
463
  if self.disable or self.fade or self.animating:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: CTkScrollableDropdownPP
3
- Version: 2.1.3
3
+ Version: 2.2
4
4
  Summary: Enhanced CTkScrollableDropdown with pagination, search and groups support
5
5
  Author: PLauncher-Team, Akash Bora
6
6
  License: MIT
@@ -20,7 +20,7 @@ Dynamic: license-file
20
20
 
21
21
  [![PyPI Downloads](https://static.pepy.tech/badge/ctkscrollabledropdownpp)](https://pepy.tech/projects/ctkscrollabledropdownpp)
22
22
 
23
- **CTkScrollableDropdownPP** is an enhanced dropdown widget for CustomTkinter featuring pagination, live search, and grouping support.
23
+ **CTkScrollableDropdownPP** is an enhanced dropdown widget for CustomTkinter featuring pagination, live search, grouping support, and multiple selection.
24
24
 
25
25
  > Based on the original [CTkScrollableDropdown](https://github.com/Akascape/CTkScrollableDropdown) project.
26
26
 
@@ -30,6 +30,7 @@ Dynamic: license-file
30
30
  * Real-time filtering
31
31
  * Grouped items (using regex or labels)
32
32
  * Autocomplete on typing
33
+ * Multiple selection support
33
34
  * Fully customizable appearance
34
35
 
35
36
  ## Installation
@@ -115,7 +116,7 @@ groups = [
115
116
  dropdown = CTkScrollableDropdown(attach=combobox, button_color="#2b2b2b", height=200, width=300, fg_color="#333333",
116
117
  values=all_values, command=lambda value: print(f"Selected: {value}"),
117
118
  image_values=all_images, text_color="#ffffff", hover_color="#3a3a3a",
118
- font=("Arial", 12), groups=groups, items_per_page=10)
119
+ font=("Arial", 12), groups=groups, items_per_page=10, multiple=True)
119
120
 
120
121
  root.mainloop()
121
122
  ```
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: CTkScrollableDropdownPP
3
- Version: 2.1.3
3
+ Version: 2.2
4
4
  Summary: Enhanced CTkScrollableDropdown with pagination, search and groups support
5
5
  Author: PLauncher-Team, Akash Bora
6
6
  License: MIT
@@ -20,7 +20,7 @@ Dynamic: license-file
20
20
 
21
21
  [![PyPI Downloads](https://static.pepy.tech/badge/ctkscrollabledropdownpp)](https://pepy.tech/projects/ctkscrollabledropdownpp)
22
22
 
23
- **CTkScrollableDropdownPP** is an enhanced dropdown widget for CustomTkinter featuring pagination, live search, and grouping support.
23
+ **CTkScrollableDropdownPP** is an enhanced dropdown widget for CustomTkinter featuring pagination, live search, grouping support, and multiple selection.
24
24
 
25
25
  > Based on the original [CTkScrollableDropdown](https://github.com/Akascape/CTkScrollableDropdown) project.
26
26
 
@@ -30,6 +30,7 @@ Dynamic: license-file
30
30
  * Real-time filtering
31
31
  * Grouped items (using regex or labels)
32
32
  * Autocomplete on typing
33
+ * Multiple selection support
33
34
  * Fully customizable appearance
34
35
 
35
36
  ## Installation
@@ -115,7 +116,7 @@ groups = [
115
116
  dropdown = CTkScrollableDropdown(attach=combobox, button_color="#2b2b2b", height=200, width=300, fg_color="#333333",
116
117
  values=all_values, command=lambda value: print(f"Selected: {value}"),
117
118
  image_values=all_images, text_color="#ffffff", hover_color="#3a3a3a",
118
- font=("Arial", 12), groups=groups, items_per_page=10)
119
+ font=("Arial", 12), groups=groups, items_per_page=10, multiple=True)
119
120
 
120
121
  root.mainloop()
121
122
  ```
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![PyPI Downloads](https://static.pepy.tech/badge/ctkscrollabledropdownpp)](https://pepy.tech/projects/ctkscrollabledropdownpp)
4
4
 
5
- **CTkScrollableDropdownPP** is an enhanced dropdown widget for CustomTkinter featuring pagination, live search, and grouping support.
5
+ **CTkScrollableDropdownPP** is an enhanced dropdown widget for CustomTkinter featuring pagination, live search, grouping support, and multiple selection.
6
6
 
7
7
  > Based on the original [CTkScrollableDropdown](https://github.com/Akascape/CTkScrollableDropdown) project.
8
8
 
@@ -12,6 +12,7 @@
12
12
  * Real-time filtering
13
13
  * Grouped items (using regex or labels)
14
14
  * Autocomplete on typing
15
+ * Multiple selection support
15
16
  * Fully customizable appearance
16
17
 
17
18
  ## Installation
@@ -97,7 +98,7 @@ groups = [
97
98
  dropdown = CTkScrollableDropdown(attach=combobox, button_color="#2b2b2b", height=200, width=300, fg_color="#333333",
98
99
  values=all_values, command=lambda value: print(f"Selected: {value}"),
99
100
  image_values=all_images, text_color="#ffffff", hover_color="#3a3a3a",
100
- font=("Arial", 12), groups=groups, items_per_page=10)
101
+ font=("Arial", 12), groups=groups, items_per_page=10, multiple=True)
101
102
 
102
103
  root.mainloop()
103
104
  ```
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "CTkScrollableDropdownPP"
7
- version = "2.1.3"
7
+ version = "2.2"
8
8
  description = "Enhanced CTkScrollableDropdown with pagination, search and groups support"
9
9
  authors = [
10
10
  {name = "PLauncher-Team"},