CTkScrollableDropdownPP 2.2__tar.gz → 2.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.
@@ -144,8 +144,9 @@ class CTkScrollableDropdown(customtkinter.CTkToplevel):
144
144
  if self.pagination:
145
145
  self.button_container = customtkinter.CTkFrame(self.frame, fg_color=self.fg_color)
146
146
  self.button_container.pack(expand=True, fill="both")
147
- self.pagination_frame = customtkinter.CTkFrame(self.frame, fg_color=self.fg_color)
148
- self.pagination_frame.pack(fill="x", side="bottom")
147
+
148
+ self.pagination_frame = customtkinter.CTkFrame(self, fg_color=self.fg_color)
149
+ self.pagination_frame.pack(fill="x", pady=(3, 0))
149
150
  else:
150
151
  self.button_container = self.frame
151
152
  self.dummy_entry = customtkinter.CTkEntry(self.frame, fg_color="transparent", border_width=0, height=1, width=1)
@@ -336,9 +337,7 @@ class CTkScrollableDropdown(customtkinter.CTkToplevel):
336
337
  total_pages = (len(values_list) + self.items_per_page - 1) // self.items_per_page
337
338
  button_width = 30
338
339
  button_padding = 4
339
- available_width = self.pagination_frame.winfo_width() if self.pagination_frame.winfo_ismapped() else self.width_new
340
- if available_width < 1:
341
- available_width = self.attach.winfo_width() if self.width is None else self.width
340
+ available_width = self.pagination_frame.winfo_width() or self.width_new or self.attach.winfo_width() or 200
342
341
  max_buttons_per_row = max(1, available_width // (button_width + button_padding))
343
342
  total_rows = (total_pages + max_buttons_per_row - 1) // max_buttons_per_row
344
343
  for row in range(total_rows):
@@ -363,20 +362,18 @@ class CTkScrollableDropdown(customtkinter.CTkToplevel):
363
362
 
364
363
  def _change_page(self, page_index):
365
364
  self.current_page = page_index
366
- if self.filtered_values is not None:
367
- values_to_show = self.filtered_values[self.current_page * self.items_per_page:
368
- (self.current_page + 1) * self.items_per_page]
369
- else:
365
+ if self.filtered_values is None:
370
366
  values_to_show = self.values[self.current_page * self.items_per_page:
371
367
  (self.current_page + 1) * self.items_per_page]
372
368
  self.update_buttons(values_to_show)
373
369
  self._update_pagination_buttons(filtered=bool(self.filtered_values))
374
370
  self.frame.update_idletasks()
375
- self.frame._parent_canvas.yview_moveto(len(values_to_show) / self.items_per_page)
371
+ ratio = len(values_to_show) / self.items_per_page
372
+ self.frame._parent_canvas.yview_moveto(0 if ratio < 0.5 else ratio)
376
373
 
377
374
  def destroy_popup(self):
378
- self.destroy()
379
- self.disable = True
375
+ self.destroy()
376
+ self.disable = True
380
377
 
381
378
  def place_dropdown(self):
382
379
  if not self.winfo_exists():
@@ -453,7 +450,7 @@ class CTkScrollableDropdown(customtkinter.CTkToplevel):
453
450
  self.current_page = 0
454
451
  self._init_buttons()
455
452
  if self.pagination:
456
- self.pagination_frame.pack(fill="x", side="bottom")
453
+ self.pagination_frame.pack(fill="x", pady=(3, 0))
457
454
  self.fade = False
458
455
  if not self.multiple:
459
456
  self._animated_withdraw()
@@ -477,11 +474,11 @@ class CTkScrollableDropdown(customtkinter.CTkToplevel):
477
474
  values_to_show = filtered
478
475
  self.update_buttons(values_to_show)
479
476
  if self.pagination:
480
- self.pagination_frame.pack(fill="x", side="bottom")
477
+ self.pagination_frame.pack(fill="x", pady=(3, 0))
481
478
  self.place_dropdown()
482
479
  else:
483
480
  if self.pagination:
484
- self.pagination_frame.pack(fill="x", side="bottom")
481
+ self.pagination_frame.pack(fill="x", pady=(3, 0))
485
482
  self.filtered_values = None
486
483
  self.current_page = 0
487
484
  self._init_buttons()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: CTkScrollableDropdownPP
3
- Version: 2.2
3
+ Version: 2.3
4
4
  Summary: Enhanced CTkScrollableDropdown with pagination, search and groups support
5
5
  Author: PLauncher-Team, Akash Bora
6
6
  License: MIT
@@ -12,7 +12,7 @@ Classifier: Operating System :: OS Independent
12
12
  Requires-Python: >=3.8
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
- Requires-Dist: customtkinter>=5.2.0
15
+ Requires-Dist: customtkinter
16
16
  Requires-Dist: pillow
17
17
  Dynamic: license-file
18
18
 
@@ -0,0 +1,2 @@
1
+ customtkinter
2
+ pillow
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: CTkScrollableDropdownPP
3
- Version: 2.2
3
+ Version: 2.3
4
4
  Summary: Enhanced CTkScrollableDropdown with pagination, search and groups support
5
5
  Author: PLauncher-Team, Akash Bora
6
6
  License: MIT
@@ -12,7 +12,7 @@ Classifier: Operating System :: OS Independent
12
12
  Requires-Python: >=3.8
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
- Requires-Dist: customtkinter>=5.2.0
15
+ Requires-Dist: customtkinter
16
16
  Requires-Dist: pillow
17
17
  Dynamic: license-file
18
18
 
@@ -1,10 +1,10 @@
1
1
  [build-system]
2
- requires = ["setuptools>=61"]
2
+ requires = ["setuptools"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "CTkScrollableDropdownPP"
7
- version = "2.2"
7
+ version = "2.3"
8
8
  description = "Enhanced CTkScrollableDropdown with pagination, search and groups support"
9
9
  authors = [
10
10
  {name = "PLauncher-Team"},
@@ -19,7 +19,7 @@ classifiers = [
19
19
  ]
20
20
  keywords = ["customtkinter", "dropdown", "pagination", "search", "groups"]
21
21
  dependencies = [
22
- "customtkinter>=5.2.0",
22
+ "customtkinter",
23
23
  "pillow"
24
24
  ]
25
25
 
@@ -1,2 +0,0 @@
1
- customtkinter>=5.2.0
2
- pillow