pygui_simple 0.5.0__tar.gz → 0.5.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.
- {pygui_simple-0.5.0 → pygui_simple-0.5.2}/PKG-INFO +1 -1
- {pygui_simple-0.5.0 → pygui_simple-0.5.2}/pyproject.toml +1 -1
- {pygui_simple-0.5.0 → pygui_simple-0.5.2}/src/pygui_simple/tkscrollpicker.py +6 -4
- {pygui_simple-0.5.0 → pygui_simple-0.5.2}/src/pygui_simple/tkslideswitch.py +2 -1
- {pygui_simple-0.5.0 → pygui_simple-0.5.2}/src/pygui_simple/tkwin.py +3 -2
- {pygui_simple-0.5.0 → pygui_simple-0.5.2}/src/pygui_simple/winbasic.py +4 -0
- {pygui_simple-0.5.0 → pygui_simple-0.5.2}/LICENSE +0 -0
- {pygui_simple-0.5.0 → pygui_simple-0.5.2}/README.md +0 -0
- {pygui_simple-0.5.0 → pygui_simple-0.5.2}/src/pygui_simple/__init__.py +0 -0
- {pygui_simple-0.5.0 → pygui_simple-0.5.2}/src/pygui_simple/py.typed +0 -0
- {pygui_simple-0.5.0 → pygui_simple-0.5.2}/src/pygui_simple/tkcalendar.py +0 -0
- {pygui_simple-0.5.0 → pygui_simple-0.5.2}/src/pygui_simple/tkcontrol.py +0 -0
- {pygui_simple-0.5.0 → pygui_simple-0.5.2}/src/pygui_simple/tkmatplot.py +0 -0
|
@@ -30,13 +30,16 @@ class ScrollPicker(tk.Frame, Generic[T]):
|
|
|
30
30
|
self._on_select: OnSelect[T] | None = on_select
|
|
31
31
|
if initial:
|
|
32
32
|
self._selected_data: T = initial
|
|
33
|
+
try:
|
|
34
|
+
self._index: int = self._val_list.index(initial)
|
|
35
|
+
except ValueError:
|
|
36
|
+
self._index = 0
|
|
33
37
|
else:
|
|
34
38
|
self._selected_data = val_list[0]
|
|
39
|
+
self._index = 0
|
|
35
40
|
|
|
36
41
|
self._background: str = cast(str, kwargs.get('background', 'white'))
|
|
37
42
|
|
|
38
|
-
self._index: int = 0
|
|
39
|
-
|
|
40
43
|
# 创建UI组件
|
|
41
44
|
self._create_widgets()
|
|
42
45
|
# 绑定鼠标事件
|
|
@@ -378,7 +381,7 @@ class TimeScrollPickerCtrl(tkControl):
|
|
|
378
381
|
self._selected_minute = int(now_list[1])
|
|
379
382
|
|
|
380
383
|
hour_list = list(range(0, 24))
|
|
381
|
-
print(hour_list)
|
|
384
|
+
# print(hour_list)
|
|
382
385
|
self._hour_scrollpicker: ScrollPicker[int] = ScrollPicker[int](self._frame,
|
|
383
386
|
hour_list, self._selected_hour,
|
|
384
387
|
self._on_hour_change,
|
|
@@ -461,7 +464,6 @@ class TimeScrollPickerDialog(Container):
|
|
|
461
464
|
selected_hour = int(now_list[0])
|
|
462
465
|
selected_minute = int(now_list[1])
|
|
463
466
|
|
|
464
|
-
# ttk.Label(self._frame, text=self._title, font=("SimHei", 12)).grid(row=0, column=0, pady=5)
|
|
465
467
|
ttk.Label(self._frame, text=self._title, font=("SimHei", 12)).pack()
|
|
466
468
|
|
|
467
469
|
self._time_scrollpicker_ctrl: TimeScrollPickerCtrl = TimeScrollPickerCtrl(self._frame, self,
|
|
@@ -344,6 +344,7 @@ class SlideSwitchCtrl(tkControl):
|
|
|
344
344
|
# Exit if no state change needed
|
|
345
345
|
if state == self._state:
|
|
346
346
|
return
|
|
347
|
+
self._state = state
|
|
347
348
|
|
|
348
349
|
# Animate to new state or set directly
|
|
349
350
|
if animate:
|
|
@@ -356,7 +357,7 @@ class SlideSwitchCtrl(tkControl):
|
|
|
356
357
|
self._on_state_changed(state)
|
|
357
358
|
|
|
358
359
|
def _on_state_changed(self, state: bool):
|
|
359
|
-
self._state = state
|
|
360
|
+
# self._state = state
|
|
360
361
|
# Trigger callback if state changed
|
|
361
362
|
if self._callback:
|
|
362
363
|
self._callback(state)
|
|
@@ -797,13 +797,13 @@ class tkWM(Generic[T], Widget):
|
|
|
797
797
|
|
|
798
798
|
# TODO: auto scrollable or not
|
|
799
799
|
class DialogCtrl(Dialog):
|
|
800
|
-
def __init__(self, app:
|
|
800
|
+
def __init__(self, app: WinBasic, dlg_cfg: et.Element):
|
|
801
801
|
attr_dict = dlg_cfg.attrib
|
|
802
802
|
super().__init__(attr_dict.get("text", ""), int(attr_dict["Width"]), int(attr_dict["Height"]), app)
|
|
803
803
|
# options: dict[str, Any] = {}
|
|
804
804
|
# if "options" in attr_dict:
|
|
805
805
|
# options = eval(attr_dict["options"])
|
|
806
|
-
self._parent: tk.Tk | tk.Toplevel = app.win
|
|
806
|
+
self._parent: tk.Tk | tk.Toplevel = cast(tk.Tk, app.win)
|
|
807
807
|
# self._owner: Dialog | None = None
|
|
808
808
|
# self._xx: int = 0
|
|
809
809
|
# self._yy: int = 0
|
|
@@ -1056,6 +1056,7 @@ class tkWin(WinBasic):
|
|
|
1056
1056
|
return 1.0 # 异常时使用默认值
|
|
1057
1057
|
|
|
1058
1058
|
@property
|
|
1059
|
+
@override
|
|
1059
1060
|
def win(self):
|
|
1060
1061
|
return self._win
|
|
1061
1062
|
|
|
@@ -219,6 +219,10 @@ class WinBasic(Container, metaclass=abc.ABCMeta):
|
|
|
219
219
|
def create_window(self):
|
|
220
220
|
pass
|
|
221
221
|
|
|
222
|
+
@property
|
|
223
|
+
def win(self) -> object:
|
|
224
|
+
pass
|
|
225
|
+
|
|
222
226
|
def create_xml(self, tag: str, attr_dict: dict[str, str], root: et.Element | None = None) -> et.Element:
|
|
223
227
|
if root is not None:
|
|
224
228
|
item_xml = et.SubElement(root, tag)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|