MoreCustomTkinterWidgets 3.0.0__tar.gz → 4.0.0__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 (31) hide show
  1. {morecustomtkinterwidgets-3.0.0/src/MoreCustomTkinterWidgets.egg-info → morecustomtkinterwidgets-4.0.0}/PKG-INFO +9 -1
  2. {morecustomtkinterwidgets-3.0.0 → morecustomtkinterwidgets-4.0.0}/README.md +8 -0
  3. {morecustomtkinterwidgets-3.0.0 → morecustomtkinterwidgets-4.0.0}/pyproject.toml +1 -1
  4. {morecustomtkinterwidgets-3.0.0 → morecustomtkinterwidgets-4.0.0}/src/MoreCustomTkinterWidgets/AnimatedImage.py +0 -13
  5. morecustomtkinterwidgets-4.0.0/src/MoreCustomTkinterWidgets/Separator.py +174 -0
  6. {morecustomtkinterwidgets-3.0.0 → morecustomtkinterwidgets-4.0.0}/src/MoreCustomTkinterWidgets/__init__.py +2 -1
  7. {morecustomtkinterwidgets-3.0.0 → morecustomtkinterwidgets-4.0.0/src/MoreCustomTkinterWidgets.egg-info}/PKG-INFO +9 -1
  8. {morecustomtkinterwidgets-3.0.0 → morecustomtkinterwidgets-4.0.0}/src/MoreCustomTkinterWidgets.egg-info/SOURCES.txt +1 -0
  9. {morecustomtkinterwidgets-3.0.0 → morecustomtkinterwidgets-4.0.0}/LICENSE +0 -0
  10. {morecustomtkinterwidgets-3.0.0 → morecustomtkinterwidgets-4.0.0}/setup.cfg +0 -0
  11. {morecustomtkinterwidgets-3.0.0 → morecustomtkinterwidgets-4.0.0}/src/MoreCustomTkinterWidgets/AskDialog.py +0 -0
  12. {morecustomtkinterwidgets-3.0.0 → morecustomtkinterwidgets-4.0.0}/src/MoreCustomTkinterWidgets/AskValue.py +0 -0
  13. {morecustomtkinterwidgets-3.0.0 → morecustomtkinterwidgets-4.0.0}/src/MoreCustomTkinterWidgets/BetterCTkImage.py +0 -0
  14. {morecustomtkinterwidgets-3.0.0 → morecustomtkinterwidgets-4.0.0}/src/MoreCustomTkinterWidgets/FileExplorer.py +0 -0
  15. {morecustomtkinterwidgets-3.0.0 → morecustomtkinterwidgets-4.0.0}/src/MoreCustomTkinterWidgets/Images/back_arrow_dark.png +0 -0
  16. {morecustomtkinterwidgets-3.0.0 → morecustomtkinterwidgets-4.0.0}/src/MoreCustomTkinterWidgets/Images/back_arrow_light.png +0 -0
  17. {morecustomtkinterwidgets-3.0.0 → morecustomtkinterwidgets-4.0.0}/src/MoreCustomTkinterWidgets/Images/error.png +0 -0
  18. {morecustomtkinterwidgets-3.0.0 → morecustomtkinterwidgets-4.0.0}/src/MoreCustomTkinterWidgets/Images/file_dark.png +0 -0
  19. {morecustomtkinterwidgets-3.0.0 → morecustomtkinterwidgets-4.0.0}/src/MoreCustomTkinterWidgets/Images/file_light.png +0 -0
  20. {morecustomtkinterwidgets-3.0.0 → morecustomtkinterwidgets-4.0.0}/src/MoreCustomTkinterWidgets/Images/folder_dark.png +0 -0
  21. {morecustomtkinterwidgets-3.0.0 → morecustomtkinterwidgets-4.0.0}/src/MoreCustomTkinterWidgets/Images/folder_light.png +0 -0
  22. {morecustomtkinterwidgets-3.0.0 → morecustomtkinterwidgets-4.0.0}/src/MoreCustomTkinterWidgets/Images/info.png +0 -0
  23. {morecustomtkinterwidgets-3.0.0 → morecustomtkinterwidgets-4.0.0}/src/MoreCustomTkinterWidgets/Images/new_folder_dark.png +0 -0
  24. {morecustomtkinterwidgets-3.0.0 → morecustomtkinterwidgets-4.0.0}/src/MoreCustomTkinterWidgets/Images/new_folder_light.png +0 -0
  25. {morecustomtkinterwidgets-3.0.0 → morecustomtkinterwidgets-4.0.0}/src/MoreCustomTkinterWidgets/Images/warning.png +0 -0
  26. {morecustomtkinterwidgets-3.0.0 → morecustomtkinterwidgets-4.0.0}/src/MoreCustomTkinterWidgets/Message.py +0 -0
  27. {morecustomtkinterwidgets-3.0.0 → morecustomtkinterwidgets-4.0.0}/src/MoreCustomTkinterWidgets/Selector.py +0 -0
  28. {morecustomtkinterwidgets-3.0.0 → morecustomtkinterwidgets-4.0.0}/src/MoreCustomTkinterWidgets/SmoothFrame.py +0 -0
  29. {morecustomtkinterwidgets-3.0.0 → morecustomtkinterwidgets-4.0.0}/src/MoreCustomTkinterWidgets.egg-info/dependency_links.txt +0 -0
  30. {morecustomtkinterwidgets-3.0.0 → morecustomtkinterwidgets-4.0.0}/src/MoreCustomTkinterWidgets.egg-info/requires.txt +0 -0
  31. {morecustomtkinterwidgets-3.0.0 → morecustomtkinterwidgets-4.0.0}/src/MoreCustomTkinterWidgets.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: MoreCustomTkinterWidgets
3
- Version: 3.0.0
3
+ Version: 4.0.0
4
4
  Summary: A package containing more widgets for customtkinter
5
5
  Author: Fastattack
6
6
  License: MIT License
@@ -57,6 +57,14 @@ It also comes with a class to ask for a file in a TopLevel (FileDialog).
57
57
 
58
58
  The FileDialog class comes with prebuilt functions to ask for files more easily: askdir, askfile
59
59
 
60
+ ### AnimatedImage
61
+ This class is used like `CTkImage` but allows to run an animation if an image sequence (FLI/FLC, GIF) was given.
62
+
63
+ You can start the animation, and it will run until you call the method to stop it, or you can run it for a given time.
64
+
65
+ ### Separator
66
+ This widget is used just like the separator in classic tkinter: it allows to separate other widgets more clearly (draws a line to separate widgets).
67
+
60
68
  ### BetterCTkImage
61
69
  This class is used like CTkImage, but you can round the images corners !
62
70
 
@@ -40,6 +40,14 @@ It also comes with a class to ask for a file in a TopLevel (FileDialog).
40
40
 
41
41
  The FileDialog class comes with prebuilt functions to ask for files more easily: askdir, askfile
42
42
 
43
+ ### AnimatedImage
44
+ This class is used like `CTkImage` but allows to run an animation if an image sequence (FLI/FLC, GIF) was given.
45
+
46
+ You can start the animation, and it will run until you call the method to stop it, or you can run it for a given time.
47
+
48
+ ### Separator
49
+ This widget is used just like the separator in classic tkinter: it allows to separate other widgets more clearly (draws a line to separate widgets).
50
+
43
51
  ### BetterCTkImage
44
52
  This class is used like CTkImage, but you can round the images corners !
45
53
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "MoreCustomTkinterWidgets"
7
- version = "3.0.0"
7
+ version = "4.0.0"
8
8
  dependencies = [
9
9
  "customtkinter>=5.2.1",
10
10
  "Pillow>=9.5.0",
@@ -136,16 +136,3 @@ class AnimatedImage(ctk.CTkImage):
136
136
  self._dark_image.seek(frame_index)
137
137
  for callback in self._configure_callback_list:
138
138
  callback()
139
-
140
-
141
- win = ctk.CTk()
142
- win.title("MoreCustomTkinterWidgets examples !")
143
- win.geometry("400x300")
144
-
145
- image = AnimatedImage(r"C:\Users\fastattack\Desktop\loading.gif", size=(100, 100))
146
- label = ctk.CTkLabel(win, text="", image=image)
147
- label.pack()
148
-
149
- image.start_animation()
150
-
151
- win.mainloop()
@@ -0,0 +1,174 @@
1
+ import customtkinter as ctk
2
+ from typing import Literal, Union, Tuple, Optional
3
+
4
+
5
+ class Separator(ctk.CTkBaseClass):
6
+ """
7
+ Separator widget to mark a separation between 2 other widgets.
8
+ Using Separator.pack(expand=True, fill="both") or Separator.grid(sticky="nswe") doesn't work for now: you have to enter the size of the separator manually.
9
+ """
10
+
11
+ def __init__(self,
12
+ master: any,
13
+ length: int = 100,
14
+ width: float = 4,
15
+ corner_radius: Optional[int] = None,
16
+ bg_color: Union[str, Tuple[str, str]] = "transparent",
17
+ fg_color: Optional[Union[str, Tuple[str, str]]] = None,
18
+ orientation: Literal["vertical", "horizontal"] = "vertical"
19
+ ):
20
+
21
+ if orientation == "vertical":
22
+ height = length
23
+ elif orientation == "horizontal":
24
+ height = width
25
+ width = length
26
+ else:
27
+ raise ValueError(f"The value for orientation is incorrect: \"{orientation}\". Should be \"vertical\" or \"horizontal\"")
28
+
29
+ super().__init__(master=master, width=width, height=height, bg_color=bg_color)
30
+
31
+ self._corner_radius = 6 if corner_radius is None else corner_radius
32
+ self._fg_color = ctk.ThemeManager.theme["CTkFrame"]["border_color"] if fg_color is None else self._check_color_type(fg_color)
33
+ self._orientation = orientation
34
+
35
+ self._canvas = ctk.CTkCanvas(self, highlightthickness=0)
36
+ self._canvas.grid(row=0, column=0, sticky="e")
37
+ self._canvas.configure(bg=self._apply_appearance_mode(self._detect_color_of_master()), width=self._apply_widget_scaling(width), height=self._apply_widget_scaling(height))
38
+ self._draw_engine = ctk.DrawEngine(self._canvas)
39
+
40
+ self._draw()
41
+
42
+ def _set_scaling(self, *args, **kwargs):
43
+ super()._set_scaling(*args, **kwargs)
44
+
45
+ self._canvas.configure(width=self._apply_widget_scaling(self._desired_width),
46
+ height=self._apply_widget_scaling(self._desired_height))
47
+ self._draw()
48
+
49
+ def _set_dimensions(self, width=None, height=None):
50
+ super()._set_dimensions(width, height)
51
+
52
+ self._canvas.configure(width=self._apply_widget_scaling(self._desired_width),
53
+ height=self._apply_widget_scaling(self._desired_height))
54
+ self._draw()
55
+
56
+ def _draw(self, no_color_updates=False):
57
+ super()._draw(no_color_updates)
58
+
59
+ requires_recoloring = self._draw_engine.draw_rounded_rect_with_border(self._apply_widget_scaling(self._current_width),
60
+ self._apply_widget_scaling(self._current_height),
61
+ self._apply_widget_scaling(self._corner_radius),
62
+ 0,
63
+ )
64
+
65
+ if no_color_updates is False or requires_recoloring:
66
+ self._canvas.itemconfig("inner_parts",
67
+ outline=self._apply_appearance_mode(self._fg_color),
68
+ fill=self._apply_appearance_mode(self._fg_color))
69
+
70
+ def configure(self, require_redraw=False, **kwargs):
71
+ """ Reconfigures the given arguments (length, width, corner_radius, bg_color, fg_color) """
72
+ if "height" in kwargs:
73
+ raise ValueError("Cannot modify directly the height of the widget. Use the length and width arguments instead.")
74
+
75
+ if "length" in kwargs or "width" in kwargs:
76
+ width, height = None, None
77
+
78
+ if "length" in kwargs:
79
+ if self._orientation == "vertical":
80
+ height = kwargs.pop("length")
81
+ else: # horizontal
82
+ width = kwargs.pop("length")
83
+ if "width" in kwargs:
84
+ if self._orientation == "vertical":
85
+ width = kwargs.pop("width")
86
+ else: # horizontal
87
+ height = kwargs.pop("width")
88
+
89
+ if width is not None:
90
+ kwargs["width"] = width
91
+ if height is not None:
92
+ kwargs["height"] = height
93
+
94
+ if "corner_radius" in kwargs:
95
+ corner_radius = kwargs.pop("corner_radius")
96
+ if type(corner_radius) is int:
97
+ self._corner_radius = corner_radius
98
+ require_redraw = True
99
+ elif corner_radius is None:
100
+ self._corner_radius = 1000
101
+ require_redraw = True
102
+ else:
103
+ raise ValueError(f"corner_radius should be int or NoneType, not {type(corner_radius)}")
104
+
105
+ if "fg_color" in kwargs:
106
+ fg_color = kwargs.pop("fg_color")
107
+ if isinstance(fg_color, (str, Tuple[str, str])):
108
+ self._fg_color = self._check_color_type(fg_color)
109
+ require_redraw = True
110
+ elif fg_color is None:
111
+ self._fg_color = ctk.ThemeManager.theme["CTkFrame"]["border_color"]
112
+ require_redraw = True
113
+ else:
114
+ raise ValueError(f"fg_color should be str, Tuple[str, str] or NoneType, not {type(fg_color)}")
115
+
116
+ super().configure(require_redraw=require_redraw, **kwargs)
117
+
118
+ def cget(self, attribute_name: str):
119
+ """ Returns the value of the given argument (length, width, corner_radius, fg_color, orientation, bg_color) """
120
+ if attribute_name == "height":
121
+ raise ValueError("Cannot directly get height of the widget. Use the length and width arguments instead.")
122
+
123
+ elif attribute_name == "length":
124
+ if self._orientation == "vertical":
125
+ return self._desired_height
126
+ else:
127
+ return self._desired_width
128
+
129
+ elif attribute_name == "width":
130
+ if self._orientation == "vertical":
131
+ return self._desired_width
132
+ else:
133
+ return self._desired_height
134
+
135
+ elif attribute_name == "corner_radius":
136
+ return self._corner_radius
137
+
138
+ elif attribute_name == "fg_color":
139
+ return self._fg_color
140
+
141
+ elif attribute_name == "orientation":
142
+ return self._orientation
143
+
144
+ else:
145
+ return super().cget(attribute_name)
146
+
147
+ def bind(self, sequence=None, command=None, add=True):
148
+ """ called on the tkinter.Canvas """
149
+ if not (add == "+" or add is True):
150
+ raise ValueError("'add' argument can only be '+' or True to preserve internal callbacks")
151
+ self._canvas.bind(sequence, command, add=True)
152
+
153
+ def unbind(self, sequence=None, funcid=None):
154
+ """ called on the tkinter.Canvas """
155
+ if funcid is not None:
156
+ raise ValueError("'funcid' argument can only be None, because there is a bug in" +
157
+ " tkinter and its not clear whether the internal callbacks will be unbinded or not")
158
+ self._canvas.unbind(sequence, None)
159
+
160
+
161
+ win = ctk.CTk()
162
+ win.title("MoreCustomTkinterWidgets examples !")
163
+ win.geometry("400x300")
164
+
165
+ b1 = ctk.CTkButton(win, text="First button")
166
+ b1.grid(row=0, column=0)
167
+
168
+ sep = Separator(win, length=150, orientation="vertical")
169
+ sep.grid(row=0, column=1, padx=5)
170
+
171
+ b2 = ctk.CTkButton(win, text="Second Button")
172
+ b2.grid(row=0, column=2)
173
+
174
+ win.mainloop()
@@ -6,6 +6,7 @@ from .Selector import Selector
6
6
  from .SmoothFrame import SmoothFrame, get_coordinates_from_grid
7
7
  from .BetterCTkImage import BetterCTkImage
8
8
  from .AnimatedImage import AnimatedImage
9
+ from .Separator import Separator
9
10
 
10
11
 
11
- _version = "3.0.0"
12
+ _version = "4.0.0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: MoreCustomTkinterWidgets
3
- Version: 3.0.0
3
+ Version: 4.0.0
4
4
  Summary: A package containing more widgets for customtkinter
5
5
  Author: Fastattack
6
6
  License: MIT License
@@ -57,6 +57,14 @@ It also comes with a class to ask for a file in a TopLevel (FileDialog).
57
57
 
58
58
  The FileDialog class comes with prebuilt functions to ask for files more easily: askdir, askfile
59
59
 
60
+ ### AnimatedImage
61
+ This class is used like `CTkImage` but allows to run an animation if an image sequence (FLI/FLC, GIF) was given.
62
+
63
+ You can start the animation, and it will run until you call the method to stop it, or you can run it for a given time.
64
+
65
+ ### Separator
66
+ This widget is used just like the separator in classic tkinter: it allows to separate other widgets more clearly (draws a line to separate widgets).
67
+
60
68
  ### BetterCTkImage
61
69
  This class is used like CTkImage, but you can round the images corners !
62
70
 
@@ -8,6 +8,7 @@ src/MoreCustomTkinterWidgets/BetterCTkImage.py
8
8
  src/MoreCustomTkinterWidgets/FileExplorer.py
9
9
  src/MoreCustomTkinterWidgets/Message.py
10
10
  src/MoreCustomTkinterWidgets/Selector.py
11
+ src/MoreCustomTkinterWidgets/Separator.py
11
12
  src/MoreCustomTkinterWidgets/SmoothFrame.py
12
13
  src/MoreCustomTkinterWidgets/__init__.py
13
14
  src/MoreCustomTkinterWidgets.egg-info/PKG-INFO