TkEasyGUI 0.1.6__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.
- tkeasygui-0.1.6/LICENSE +21 -0
- tkeasygui-0.1.6/PKG-INFO +87 -0
- tkeasygui-0.1.6/README.md +66 -0
- tkeasygui-0.1.6/pyproject.toml +38 -0
- tkeasygui-0.1.6/setup.cfg +4 -0
- tkeasygui-0.1.6/tkeasygui/__init__.py +9 -0
- tkeasygui-0.1.6/tkeasygui/dialogs.py +167 -0
- tkeasygui-0.1.6/tkeasygui/widgets.py +1005 -0
- tkeasygui-0.1.6/tkeasygui.egg-info/PKG-INFO +87 -0
- tkeasygui-0.1.6/tkeasygui.egg-info/SOURCES.txt +10 -0
- tkeasygui-0.1.6/tkeasygui.egg-info/dependency_links.txt +1 -0
- tkeasygui-0.1.6/tkeasygui.egg-info/top_level.txt +1 -0
tkeasygui-0.1.6/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 kujirahand
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
tkeasygui-0.1.6/PKG-INFO
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: tkeasygui
|
|
3
|
+
Version: 0.1.6
|
|
4
|
+
Summary: Easy and Simple GUI Library
|
|
5
|
+
Author-email: kujirahand <web@kujirahand.com>
|
|
6
|
+
Project-URL: Homepage, https://github.com/kujirahand/tkeasygui-pythont
|
|
7
|
+
Project-URL: Issues, https://github.com/kujirahand/tkeasygui-python/issues
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Topic :: Software Development :: User Interfaces
|
|
18
|
+
Requires-Python: >=3.8
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
|
|
22
|
+
# TkEasyGUI
|
|
23
|
+
|
|
24
|
+
`TkEasyGUI` is a Python library that allows for the easy and simple creation of GUI applications.
|
|
25
|
+
In the event model, it is compatible with the well-known GUI library `PySimpleGUI`.
|
|
26
|
+
|
|
27
|
+
Python's standard UI library `Tkinter`, is often considered to have a high barrier to entry and to be difficult to use. By using this library, you can create GUI applications easily and intuitively.
|
|
28
|
+
|
|
29
|
+
## Install
|
|
30
|
+
|
|
31
|
+
Install from pypi
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
python -m pip install tkeasygui
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Install from GitHub Repository
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
python -m pip install git+https://github.com/kujirahand/tkeasygui-python
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## How to use
|
|
46
|
+
|
|
47
|
+
To create a simple window with only labels and buttons, you would write as follows:
|
|
48
|
+
|
|
49
|
+
```py
|
|
50
|
+
import tkeasygui as eg
|
|
51
|
+
|
|
52
|
+
# Create window
|
|
53
|
+
layout = [
|
|
54
|
+
[eg.Text("Hello, World!")],
|
|
55
|
+
[eg.Button("OK")]
|
|
56
|
+
]
|
|
57
|
+
window = eg.Window("Hello", layout=layout)
|
|
58
|
+
|
|
59
|
+
# Event loop
|
|
60
|
+
while window.is_alive():
|
|
61
|
+
# get event
|
|
62
|
+
event, values = window.read()
|
|
63
|
+
# check event
|
|
64
|
+
if event == "OK":
|
|
65
|
+
eg.popup("Pushed OK Button")
|
|
66
|
+
break
|
|
67
|
+
window.close()
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Samples
|
|
71
|
+
|
|
72
|
+
- [samples](https://github.com/kujirahand/tkeasygui-python/tree/main/tests).
|
|
73
|
+
|
|
74
|
+
## Documents
|
|
75
|
+
|
|
76
|
+
- [docs](https://github.com/kujirahand/tkeasygui-python/tree/main/docs)
|
|
77
|
+
|
|
78
|
+
## Regarding the relationship with PySimpleGUI
|
|
79
|
+
|
|
80
|
+
This was developed with reference to PySimpleGUI, but has been re-implemented from scratch.
|
|
81
|
+
While its usage is similar to PySimpleGUI, it has been expanded with unique features.
|
|
82
|
+
|
|
83
|
+
## Link
|
|
84
|
+
|
|
85
|
+
- [pypi.org > TkEasyGUI](https://pypi.org/project/tkeasygui/)
|
|
86
|
+
- [GitHub > TkEasyGUI](https://github.com/kujirahand/tkeasygui-python/)
|
|
87
|
+
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# TkEasyGUI
|
|
2
|
+
|
|
3
|
+
`TkEasyGUI` is a Python library that allows for the easy and simple creation of GUI applications.
|
|
4
|
+
In the event model, it is compatible with the well-known GUI library `PySimpleGUI`.
|
|
5
|
+
|
|
6
|
+
Python's standard UI library `Tkinter`, is often considered to have a high barrier to entry and to be difficult to use. By using this library, you can create GUI applications easily and intuitively.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
Install from pypi
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
python -m pip install tkeasygui
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Install from GitHub Repository
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
python -m pip install git+https://github.com/kujirahand/tkeasygui-python
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## How to use
|
|
25
|
+
|
|
26
|
+
To create a simple window with only labels and buttons, you would write as follows:
|
|
27
|
+
|
|
28
|
+
```py
|
|
29
|
+
import tkeasygui as eg
|
|
30
|
+
|
|
31
|
+
# Create window
|
|
32
|
+
layout = [
|
|
33
|
+
[eg.Text("Hello, World!")],
|
|
34
|
+
[eg.Button("OK")]
|
|
35
|
+
]
|
|
36
|
+
window = eg.Window("Hello", layout=layout)
|
|
37
|
+
|
|
38
|
+
# Event loop
|
|
39
|
+
while window.is_alive():
|
|
40
|
+
# get event
|
|
41
|
+
event, values = window.read()
|
|
42
|
+
# check event
|
|
43
|
+
if event == "OK":
|
|
44
|
+
eg.popup("Pushed OK Button")
|
|
45
|
+
break
|
|
46
|
+
window.close()
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Samples
|
|
50
|
+
|
|
51
|
+
- [samples](https://github.com/kujirahand/tkeasygui-python/tree/main/tests).
|
|
52
|
+
|
|
53
|
+
## Documents
|
|
54
|
+
|
|
55
|
+
- [docs](https://github.com/kujirahand/tkeasygui-python/tree/main/docs)
|
|
56
|
+
|
|
57
|
+
## Regarding the relationship with PySimpleGUI
|
|
58
|
+
|
|
59
|
+
This was developed with reference to PySimpleGUI, but has been re-implemented from scratch.
|
|
60
|
+
While its usage is similar to PySimpleGUI, it has been expanded with unique features.
|
|
61
|
+
|
|
62
|
+
## Link
|
|
63
|
+
|
|
64
|
+
- [pypi.org > TkEasyGUI](https://pypi.org/project/tkeasygui/)
|
|
65
|
+
- [GitHub > TkEasyGUI](https://github.com/kujirahand/tkeasygui-python/)
|
|
66
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "tkeasygui"
|
|
3
|
+
version = "0.1.6"
|
|
4
|
+
authors = [
|
|
5
|
+
{ name="kujirahand", email="web@kujirahand.com" },
|
|
6
|
+
]
|
|
7
|
+
description = "Easy and Simple GUI Library"
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
requires-python = ">=3.8"
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Intended Audience :: Developers",
|
|
12
|
+
"License :: OSI Approved :: MIT License",
|
|
13
|
+
"Programming Language :: Python :: 3",
|
|
14
|
+
"Programming Language :: Python :: 3.8",
|
|
15
|
+
"Programming Language :: Python :: 3.9",
|
|
16
|
+
"Programming Language :: Python :: 3.10",
|
|
17
|
+
"Programming Language :: Python :: 3.11",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
20
|
+
"Topic :: Software Development :: User Interfaces",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[build-system]
|
|
24
|
+
requires = ["setuptools"]
|
|
25
|
+
build-backend = "setuptools.build_meta"
|
|
26
|
+
|
|
27
|
+
[project.urls]
|
|
28
|
+
Homepage = "https://github.com/kujirahand/tkeasygui-pythont"
|
|
29
|
+
Issues = "https://github.com/kujirahand/tkeasygui-python/issues"
|
|
30
|
+
|
|
31
|
+
[tool.poetry.dependencies]
|
|
32
|
+
python = "^3.8"
|
|
33
|
+
tkinter = "*"
|
|
34
|
+
Pillow = "*"
|
|
35
|
+
|
|
36
|
+
[tool.ruff.lint]
|
|
37
|
+
select = ["E", "F", "I"]
|
|
38
|
+
ignore = ["E501"]
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"""
|
|
2
|
+
TkEasyGUI dialogs
|
|
3
|
+
"""
|
|
4
|
+
import tkinter.filedialog as filedialog
|
|
5
|
+
import tkinter.messagebox as messagebox
|
|
6
|
+
import tkinter.simpledialog as simpledialog
|
|
7
|
+
from tkinter import colorchooser
|
|
8
|
+
|
|
9
|
+
import tkeasygui as eg
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
#------------------------------------------------------------------------------
|
|
13
|
+
# Dialogs
|
|
14
|
+
#------------------------------------------------------------------------------
|
|
15
|
+
# like PySimpleGUI
|
|
16
|
+
def popup(message: str, title: str = "") -> None:
|
|
17
|
+
"""
|
|
18
|
+
Display a message in a popup window.
|
|
19
|
+
|
|
20
|
+
#### Example:
|
|
21
|
+
```py
|
|
22
|
+
eg.popup("I like an apple.", "Information")
|
|
23
|
+
```
|
|
24
|
+
"""
|
|
25
|
+
# messagebox.showinfo(title, message)
|
|
26
|
+
win = eg.Window(title, layout=[[eg.Text(message)], [eg.Button("OK")]], modal=True)
|
|
27
|
+
while win.is_alive():
|
|
28
|
+
event, _ = win.read()
|
|
29
|
+
if event in (None, "OK"):
|
|
30
|
+
break
|
|
31
|
+
win.close()
|
|
32
|
+
|
|
33
|
+
def popup_ok(message: str, title: str="") -> None:
|
|
34
|
+
"""Display a message in a popup window.(Alias popup)"""
|
|
35
|
+
popup(title, message)
|
|
36
|
+
|
|
37
|
+
def popup_buttons(message: str, title: str = "Question", buttons: list[str] = ["OK", "Cancel"]) -> str:
|
|
38
|
+
"""
|
|
39
|
+
Popup window with user defined buttons. Return button's label.
|
|
40
|
+
|
|
41
|
+
#### Example:
|
|
42
|
+
```py
|
|
43
|
+
color = eg.popup_buttons(
|
|
44
|
+
"Which color do you like?",
|
|
45
|
+
"Question",
|
|
46
|
+
buttons=["red","yellow","green"])
|
|
47
|
+
print(color)
|
|
48
|
+
```
|
|
49
|
+
"""
|
|
50
|
+
result = buttons[-1]
|
|
51
|
+
# create window
|
|
52
|
+
win = eg.Window(title, layout=[
|
|
53
|
+
[eg.Text(message)],
|
|
54
|
+
[eg.Button(s, width=9) for s in buttons],
|
|
55
|
+
], modal=True)
|
|
56
|
+
# event loop
|
|
57
|
+
while win.is_alive():
|
|
58
|
+
event, _ = win.read()
|
|
59
|
+
if event in buttons:
|
|
60
|
+
result = event
|
|
61
|
+
break
|
|
62
|
+
win.close()
|
|
63
|
+
return result
|
|
64
|
+
|
|
65
|
+
def popup_yes_no(message: str, title: str = "Question", yes_label: str="Yes", no_label: str="No") -> str:
|
|
66
|
+
"""
|
|
67
|
+
Display a message in a popup window with Yes and No buttons. Return "Yes" or "No".
|
|
68
|
+
|
|
69
|
+
#### Example:
|
|
70
|
+
Ask user question, [Yes] or [No]
|
|
71
|
+
```py
|
|
72
|
+
a = eg.popup_yes_no("Do you like Sushi?", "Question")
|
|
73
|
+
print(a) # "Yes" or "No"
|
|
74
|
+
```
|
|
75
|
+
Ask user question in Japanes [はい] or [いいえ]
|
|
76
|
+
```py
|
|
77
|
+
ja_a = eg.popup_yes_no("寿司は好き?", "質問", yes_label="はい", no_label="いいえ")
|
|
78
|
+
print(ja_a) # "はい" or "いいえ"
|
|
79
|
+
```
|
|
80
|
+
"""
|
|
81
|
+
# return "Yes" if messagebox.askyesno(title, message) else "No"
|
|
82
|
+
return popup_buttons(message, title, buttons=[yes_label, no_label])
|
|
83
|
+
|
|
84
|
+
def popup_yes_no_cancel(message: str, title: str = "Question") -> str:
|
|
85
|
+
"""Display a message in a popup window with Yes and No buttons. Return "Yes" or "No" or "Cancel"."""
|
|
86
|
+
return popup_buttons(message, title, buttons=["Yes", "No", "Cancel"])
|
|
87
|
+
|
|
88
|
+
def popup_get_text(message: str, title: str = "", default: str = "") -> (str|None):
|
|
89
|
+
"""Display a message in a popup window with a text entry. Return the text entered."""
|
|
90
|
+
return simpledialog.askstring(title, message, initialvalue=default)
|
|
91
|
+
|
|
92
|
+
def popup_input(message: str, title: str = "", default: str = "") -> (str|None):
|
|
93
|
+
"""Display a message in a popup window with a text entry. Return the text entered."""
|
|
94
|
+
result = None
|
|
95
|
+
win = eg.Window(title, layout=[
|
|
96
|
+
[eg.Text(message)],
|
|
97
|
+
[eg.Input(default, key="-user-", width=40)],
|
|
98
|
+
[eg.Button("OK", width=9), eg.Button("Cancel", width=9)]
|
|
99
|
+
], modal=True)
|
|
100
|
+
while win.is_alive():
|
|
101
|
+
event, values = win.read()
|
|
102
|
+
if event == "OK":
|
|
103
|
+
result = values["-user-"]
|
|
104
|
+
break
|
|
105
|
+
if event == "Cancel":
|
|
106
|
+
break
|
|
107
|
+
win.close()
|
|
108
|
+
return result
|
|
109
|
+
|
|
110
|
+
def popup_error(message: str, title: str="Error") -> None:
|
|
111
|
+
"""Display a message in a popup window with an error icon."""
|
|
112
|
+
messagebox.showerror(title, message, icon="error")
|
|
113
|
+
|
|
114
|
+
def popup_get_file(title: str="", initial_folder: str="", save_as: bool=False, multiple_files: bool=False, file_types: tuple[tuple[str, str]]=(("All Files", "*.*"),), **kw) -> (str|tuple[str]|None):
|
|
115
|
+
"""Popup a file selection dialog. Return the file selected."""
|
|
116
|
+
if save_as:
|
|
117
|
+
result = filedialog.asksaveasfilename(
|
|
118
|
+
title=title,
|
|
119
|
+
initialdir=initial_folder,
|
|
120
|
+
filetypes=file_types,
|
|
121
|
+
**kw)
|
|
122
|
+
else:
|
|
123
|
+
result = filedialog.askopenfilename(
|
|
124
|
+
title=title,
|
|
125
|
+
initialdir=initial_folder,
|
|
126
|
+
filetypes=file_types,
|
|
127
|
+
multiple=multiple_files, # type: ignore
|
|
128
|
+
**kw)
|
|
129
|
+
return result
|
|
130
|
+
|
|
131
|
+
def popup_get_folder(title: str="", default_path: str="", **kw) -> (str|None):
|
|
132
|
+
"""Popup a folder selection dialog. Return the folder selected."""
|
|
133
|
+
return filedialog.askdirectory(title=title, initialdir=default_path, **kw)
|
|
134
|
+
|
|
135
|
+
def popup_color(title: str="", default_color: str|None=None) -> (str|None):
|
|
136
|
+
"""Popup a color selection dialog. Return the color selected."""
|
|
137
|
+
col = colorchooser.askcolor(title=title, color=default_color)
|
|
138
|
+
if col[1] is None:
|
|
139
|
+
return default_color
|
|
140
|
+
return col[1]
|
|
141
|
+
|
|
142
|
+
#------------------------------------------------------------------------------
|
|
143
|
+
# TKinter
|
|
144
|
+
def ask_yes_no(message: str, title: str="Question") -> bool:
|
|
145
|
+
"""Display a message in a popup window with Yes and No buttons. Return True or False. (use Tkinter)"""
|
|
146
|
+
return messagebox.askyesno(title, message)
|
|
147
|
+
|
|
148
|
+
def ask_ok_cancel(message: str, title: str="Question") -> bool:
|
|
149
|
+
"""Display a message in a popup window with OK and Cancel buttons. Return True or False. (use Tkinter)"""
|
|
150
|
+
return messagebox.askokcancel(title, message)
|
|
151
|
+
|
|
152
|
+
def ask_retry_cancel(message: str, title: str="Question") -> bool:
|
|
153
|
+
"""Display a message in a popup window with Retry and Cancel buttons. Return True or False. (use Tkinter)"""
|
|
154
|
+
return messagebox.askretrycancel(title, message)
|
|
155
|
+
|
|
156
|
+
def show_message(message: str, title: str="Information") -> None:
|
|
157
|
+
"""show message in a popup window"""
|
|
158
|
+
messagebox.showinfo(title, message)
|
|
159
|
+
|
|
160
|
+
def show_info(message: str, title: str="Information") -> None:
|
|
161
|
+
"""show message in a popup window"""
|
|
162
|
+
messagebox.showinfo(title, message)
|
|
163
|
+
|
|
164
|
+
def msgbox(message: str, title: str="Message") -> None:
|
|
165
|
+
"""show message in a popup window like VB"""
|
|
166
|
+
messagebox.showinfo(title, message)
|
|
167
|
+
|