pygui_simple 0.3.0__tar.gz → 0.3.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pygui_simple
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: A simple gui library
5
5
  Author: Youchee
6
6
  Author-email: Youchee <youchi.xu@live.com>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pygui_simple"
3
- version = "0.3.0"
3
+ version = "0.3.1"
4
4
  description = "A simple gui library"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -452,7 +452,7 @@ class CalendarDialog(Container):
452
452
  point: Optional (x, y) screen coordinates for the dialog window;
453
453
  defaults to screen center if None
454
454
  """
455
- super().__init__("", 0, 0)
455
+ super().__init__()
456
456
 
457
457
  # Initialize hidden top-level window
458
458
  self._top: tk.Toplevel = tk.Toplevel()
@@ -442,7 +442,7 @@ class TimeScrollPickerCtrl(tkControl):
442
442
  class TimeScrollPickerDialog(Container):
443
443
  def __init__(self, point: tuple[int, int] | None = None,
444
444
  title: str = "", initial: str = ""):
445
- super().__init__(title, 0, 0)
445
+ super().__init__()
446
446
 
447
447
  self._master: tk.Toplevel = tk.Toplevel()
448
448
  self._master.withdraw()
@@ -498,7 +498,6 @@ class TimeScrollPickerDialog(Container):
498
498
  self._master.focus_set()
499
499
  self._master.wait_window()
500
500
 
501
- @override
502
501
  def _confirm(self, **kwargs: object):
503
502
  self._exit()
504
503
  return True, ""
@@ -540,6 +539,7 @@ class TimeScrollPickerDialog(Container):
540
539
  def destroy(self, **kwargs: object):
541
540
  pass
542
541
 
542
+
543
543
  if __name__ == "__main__":
544
544
  class ScrollPickerCtrl_test():
545
545
  def __init__(self):
@@ -656,8 +656,8 @@ class DialogCtrl(Dialog):
656
656
  # options = eval(attr_dict["options"])
657
657
  self._parent: tk.Tk | tk.Toplevel = app.win
658
658
  # self._owner: Dialog | None = None
659
- self._xx: int = 0
660
- self._yy: int = 0
659
+ # self._xx: int = 0
660
+ # self._yy: int = 0
661
661
  self._top: tkWM[tk.Toplevel] | None = None
662
662
  self._alive: bool = False
663
663
  self._idself: str = attr_dict["id"]
@@ -672,9 +672,8 @@ class DialogCtrl(Dialog):
672
672
  # else:
673
673
  # return self._app
674
674
 
675
- @override
676
675
  def set_title(self, val: str):
677
- super().set_title(val)
676
+ self._title = val
678
677
  if self._top is not None:
679
678
  self._top.control.title(self._title)
680
679
 
@@ -943,9 +942,8 @@ class tkWin(WinBasic):
943
942
  # 设置窗口大小并居中
944
943
  self._win.geometry(f"{width}x{hight}+{cen_x}+{cen_y}")
945
944
 
946
- @override
947
945
  def set_title(self, val: str):
948
- super().set_title(val)
946
+ self._title = val
949
947
  self._win.title(self._title)
950
948
 
951
949
  @override
@@ -82,7 +82,7 @@ class Control(Widget, metaclass=abc.ABCMeta):
82
82
 
83
83
 
84
84
  class Container(Widget, metaclass=abc.ABCMeta):
85
- def __init__(self, title: str, width: int, height: int, owner: Container | None = None):
85
+ def __init__(self, owner: Container | None = None):
86
86
  super().__init__()
87
87
  self._eventhandler_dict: dict[str, list[EventHanlder]] = {}
88
88
  self._msgs_hanlders: list[tuple[int, list[str], EventsHanlder]] = []
@@ -90,12 +90,6 @@ class Container(Widget, metaclass=abc.ABCMeta):
90
90
 
91
91
  self._backed: bool = True
92
92
 
93
- self._xx: int = 0
94
- self._yy: int = 0
95
- self._ww: int = width
96
- self._hh: int = height
97
- self._title: str = title
98
-
99
93
  self._idctrl_dict: OrderedDict[str, Widget] = OrderedDict()
100
94
 
101
95
  @property
@@ -106,21 +100,6 @@ class Container(Widget, metaclass=abc.ABCMeta):
106
100
  def owner(self, val: "Container"):
107
101
  self._owner = val
108
102
 
109
- @property
110
- def title(self):
111
- return self._title
112
-
113
- def set_title(self, val: str):
114
- self._title = val
115
-
116
- @property
117
- def pos(self):
118
- return self._xx, self._yy
119
-
120
- @property
121
- def size(self):
122
- return self._ww, self._hh
123
-
124
103
  def back(self, bset: bool = True):
125
104
  for idctrl, ctrl in self._idctrl_dict.items():
126
105
  try:
@@ -210,10 +189,32 @@ class WinBasic(Container, metaclass=abc.ABCMeta):
210
189
  w, h = int(win_attr["Width"]), int(win_attr["Height"])
211
190
  else:
212
191
  w, h = 0, 0
213
- super().__init__(win_attr["Title"], w, h)
192
+ super().__init__()
214
193
 
215
194
  self._customctrl_dict: dict[str, et.Element] = {}
216
195
 
196
+ self._xx: int = 0
197
+ self._yy: int = 0
198
+ self._ww: int = w
199
+ self._hh: int = h
200
+ self._title: str = win_attr["Title"]
201
+
202
+ @property
203
+ def title(self):
204
+ return self._title
205
+
206
+ @title.setter
207
+ def title(self, val: str):
208
+ self._title = val
209
+
210
+ @property
211
+ def pos(self):
212
+ return self._xx, self._yy
213
+
214
+ @property
215
+ def size(self):
216
+ return self._ww, self._hh
217
+
217
218
  @abc.abstractmethod
218
219
  def create_window(self):
219
220
  pass
@@ -299,9 +300,31 @@ class WinBasic(Container, metaclass=abc.ABCMeta):
299
300
 
300
301
  class Dialog(Container, metaclass=abc.ABCMeta):
301
302
  def __init__(self, title: str, width: int, height: int, app: WinBasic):
302
- super().__init__(title, width, height)
303
+ super().__init__()
303
304
  self._app: WinBasic = app
304
305
 
306
+ self._xx: int = 0
307
+ self._yy: int = 0
308
+ self._ww: int = width
309
+ self._hh: int = height
310
+ self._title: str = title
311
+
312
+ @property
313
+ def title(self):
314
+ return self._title
315
+
316
+ @title.setter
317
+ def title(self, val: str):
318
+ self._title = val
319
+
320
+ @property
321
+ def pos(self):
322
+ return self._xx, self._yy
323
+
324
+ @property
325
+ def size(self):
326
+ return self._ww, self._hh
327
+
305
328
  @property
306
329
  def backed(self):
307
330
  return self._backed
File without changes
File without changes