lb-auto-tk 0.0.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.
- lb_auto_tk-0.0.2/LICENSE +24 -0
- lb_auto_tk-0.0.2/PKG-INFO +168 -0
- lb_auto_tk-0.0.2/README.md +155 -0
- lb_auto_tk-0.0.2/lb_auto_tk/__init__.py +2 -0
- lb_auto_tk-0.0.2/lb_auto_tk/button.py +14 -0
- lb_auto_tk-0.0.2/lb_auto_tk/colors.py +10 -0
- lb_auto_tk-0.0.2/lb_auto_tk/core.py +46 -0
- lb_auto_tk-0.0.2/lb_auto_tk/dropdown.py +22 -0
- lb_auto_tk-0.0.2/lb_auto_tk/input.py +32 -0
- lb_auto_tk-0.0.2/lb_auto_tk/listbox.py +32 -0
- lb_auto_tk-0.0.2/lb_auto_tk/radio.py +16 -0
- lb_auto_tk-0.0.2/lb_auto_tk/slider.py +25 -0
- lb_auto_tk-0.0.2/lb_auto_tk/utils.py +12 -0
- lb_auto_tk-0.0.2/lb_auto_tk.egg-info/PKG-INFO +168 -0
- lb_auto_tk-0.0.2/lb_auto_tk.egg-info/SOURCES.txt +18 -0
- lb_auto_tk-0.0.2/lb_auto_tk.egg-info/dependency_links.txt +1 -0
- lb_auto_tk-0.0.2/lb_auto_tk.egg-info/top_level.txt +1 -0
- lb_auto_tk-0.0.2/pyproject.toml +12 -0
- lb_auto_tk-0.0.2/setup.cfg +4 -0
- lb_auto_tk-0.0.2/setup.py +15 -0
lb_auto_tk-0.0.2/LICENSE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Copyright (c) 2026 logic-break
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software for NON-COMMERCIAL PURPOSES ONLY, subject to the following
|
|
6
|
+
conditions:
|
|
7
|
+
|
|
8
|
+
1. The above copyright notice and this permission notice shall be included in all
|
|
9
|
+
copies or substantial portions of the Software.
|
|
10
|
+
|
|
11
|
+
2. The Software, or any substantial portion thereof, may NOT be sold, resold,
|
|
12
|
+
licensed, or otherwise exploited for any commercial advantage or private
|
|
13
|
+
monetary gain without prior written permission from the copyright holder.
|
|
14
|
+
|
|
15
|
+
3. Any derivative works or software incorporating this Software must also be
|
|
16
|
+
distributed under these same non-commercial terms.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
SOFTWARE.
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: lb-auto-tk
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: A not-so professional dark-mode GUI framework for quick application building
|
|
5
|
+
Author: abobus
|
|
6
|
+
Author-email: logic-break <abibasqabiba@email.com>
|
|
7
|
+
Requires-Python: >=3.6
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Dynamic: author
|
|
11
|
+
Dynamic: license-file
|
|
12
|
+
Dynamic: requires-python
|
|
13
|
+
|
|
14
|
+
# lb-auto-tk: lib for lazy
|
|
15
|
+
© Copyright logic-break 2026
|
|
16
|
+
https://logic-break.github.io
|
|
17
|
+
|
|
18
|
+
> lib made for lazy, by lazy
|
|
19
|
+
|
|
20
|
+
installation:
|
|
21
|
+
|
|
22
|
+
pip install lb_auto_tk
|
|
23
|
+
|
|
24
|
+
## Usage:
|
|
25
|
+
|
|
26
|
+
### 1. Main Application Class
|
|
27
|
+
|
|
28
|
+
- **`LbAutoTk(title="App")`**
|
|
29
|
+
|
|
30
|
+
- `title`: The text displayed on the window title bar.
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
----------
|
|
34
|
+
|
|
35
|
+
### 2. UI Components (Core Methods)
|
|
36
|
+
|
|
37
|
+
- **`header(text)`**
|
|
38
|
+
|
|
39
|
+
- `text`: Large, bold display text used as a section title inside the UI.
|
|
40
|
+
|
|
41
|
+
- **`input(label, f_type="any")`**
|
|
42
|
+
|
|
43
|
+
- `label`: The caption text above the input field.
|
|
44
|
+
|
|
45
|
+
- `f_type`: Validation type. Options: `"any"`, `"float"` (numbers/decimals only), `"no digits"` (blocks numbers).
|
|
46
|
+
|
|
47
|
+
- **`button(text, func, type="primary")`**
|
|
48
|
+
|
|
49
|
+
- `text`: Label on the button.
|
|
50
|
+
|
|
51
|
+
- `func`: The function to execute when clicked.
|
|
52
|
+
|
|
53
|
+
- `type`: Styling choice. `"primary"` (Accent Blue) or `"secondary"` (Dark Gray).
|
|
54
|
+
|
|
55
|
+
- **`dropdown(label, options, callback)`**
|
|
56
|
+
|
|
57
|
+
- `label`: The caption above the selection menu.
|
|
58
|
+
|
|
59
|
+
- `options`: A list of strings, e.g., `["High", "Medium", "Low"]`.
|
|
60
|
+
|
|
61
|
+
- `callback`: Function that runs immediately when a value is selected.
|
|
62
|
+
|
|
63
|
+
- **`slider(label, start, end, step=1, callback=None)`**
|
|
64
|
+
|
|
65
|
+
- `label`: The name of the setting.
|
|
66
|
+
|
|
67
|
+
- `start` / `end`: Range values (min/max).
|
|
68
|
+
|
|
69
|
+
- `step`: The increment value (e.g., `1` or `0.5`).
|
|
70
|
+
|
|
71
|
+
- `callback`: Function that runs while the slider is moving.
|
|
72
|
+
|
|
73
|
+
- **`radio(label, options)`**
|
|
74
|
+
|
|
75
|
+
- `label`: Title of the radio group.
|
|
76
|
+
|
|
77
|
+
- `options`: List of strings for the selectable options.
|
|
78
|
+
|
|
79
|
+
- **`listbox(label, height=6)`**
|
|
80
|
+
|
|
81
|
+
- `label`: Title for the log/history window.
|
|
82
|
+
|
|
83
|
+
- `height`: How many lines high the box should be.
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
----------
|
|
87
|
+
|
|
88
|
+
### 3. Widget Methods (Interaction)
|
|
89
|
+
|
|
90
|
+
- **For Input:**
|
|
91
|
+
|
|
92
|
+
- `.get()`: Returns the current string typed in the field.
|
|
93
|
+
|
|
94
|
+
- `.clear()`: Erases all text from the field.
|
|
95
|
+
|
|
96
|
+
- **For Dropdown:**
|
|
97
|
+
|
|
98
|
+
- `.get()`: Returns the currently selected option string.
|
|
99
|
+
|
|
100
|
+
- **For Listbox:**
|
|
101
|
+
|
|
102
|
+
- `.add(text)`: Pushes a new line to the top of the box (adds `>` prefix automatically).
|
|
103
|
+
|
|
104
|
+
- `.clear()`: Deletes all entries in the log.
|
|
105
|
+
|
|
106
|
+
- **For Radio:**
|
|
107
|
+
|
|
108
|
+
- `.var.get()`: Retrieves the string value of the selected radio button.
|
|
109
|
+
|
|
110
|
+
- **For Slider:**
|
|
111
|
+
|
|
112
|
+
- `.info.cget("text")`: Useful for grabbing the formatted "Label: Value" string from the UI.
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
----------
|
|
116
|
+
|
|
117
|
+
### 4. Execution
|
|
118
|
+
|
|
119
|
+
- **`app.run()`**
|
|
120
|
+
|
|
121
|
+
- Starts the Tkinter main loop to display your window.
|
|
122
|
+
|
|
123
|
+
## Example:
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
from lb_auto_tk import LbAutoTk
|
|
127
|
+
|
|
128
|
+
# 1. Setup App
|
|
129
|
+
app = LbAutoTk("AI Image Studio")
|
|
130
|
+
app.header("Image Generator")
|
|
131
|
+
|
|
132
|
+
# 2. Text Inputs
|
|
133
|
+
prompt = app.input("Prompt", f_type="any")
|
|
134
|
+
negative = app.input("Negative Prompt", f_type="any")
|
|
135
|
+
|
|
136
|
+
# 3. Dropdown (Model Selection)
|
|
137
|
+
def on_model_change(val):
|
|
138
|
+
status.add(f"Switched to model: {val}")
|
|
139
|
+
model = app.dropdown("AI Model", ["Stable Diffusion v2.1", "Midjourney v6", "DALL-E 3"], on_model_change)
|
|
140
|
+
|
|
141
|
+
# 4. Radio Buttons (Aspect Ratio)
|
|
142
|
+
ratio = app.radio("Aspect Ratio", ["1:1", "16:9", "9:16"])
|
|
143
|
+
|
|
144
|
+
# 5. Slider (Sampling Steps)
|
|
145
|
+
steps = app.slider("Sampling Steps", 10, 100, 1)
|
|
146
|
+
|
|
147
|
+
# 6. Listbox (System Logs)
|
|
148
|
+
status = app.listbox("System Status", height=5)
|
|
149
|
+
|
|
150
|
+
# 7. Interaction Logic
|
|
151
|
+
def generate():
|
|
152
|
+
p = prompt.get()
|
|
153
|
+
m = model.get()
|
|
154
|
+
r = ratio.var.get()
|
|
155
|
+
s = steps.info.cget("text") # Get value from slider label
|
|
156
|
+
|
|
157
|
+
if not p:
|
|
158
|
+
status.add("ERROR: Prompt is empty!")
|
|
159
|
+
return
|
|
160
|
+
|
|
161
|
+
status.add(f"Generating '{p}'...")
|
|
162
|
+
status.add(f"Config: {m} | Ratio: {r} | {s}")
|
|
163
|
+
|
|
164
|
+
# 8. Buttons
|
|
165
|
+
app.button("GENERATE IMAGE", generate)
|
|
166
|
+
app.button("CLEAR LOGS", lambda: status.clear(), type="secondary")
|
|
167
|
+
|
|
168
|
+
app.run()
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# lb-auto-tk: lib for lazy
|
|
2
|
+
© Copyright logic-break 2026
|
|
3
|
+
https://logic-break.github.io
|
|
4
|
+
|
|
5
|
+
> lib made for lazy, by lazy
|
|
6
|
+
|
|
7
|
+
installation:
|
|
8
|
+
|
|
9
|
+
pip install lb_auto_tk
|
|
10
|
+
|
|
11
|
+
## Usage:
|
|
12
|
+
|
|
13
|
+
### 1. Main Application Class
|
|
14
|
+
|
|
15
|
+
- **`LbAutoTk(title="App")`**
|
|
16
|
+
|
|
17
|
+
- `title`: The text displayed on the window title bar.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
----------
|
|
21
|
+
|
|
22
|
+
### 2. UI Components (Core Methods)
|
|
23
|
+
|
|
24
|
+
- **`header(text)`**
|
|
25
|
+
|
|
26
|
+
- `text`: Large, bold display text used as a section title inside the UI.
|
|
27
|
+
|
|
28
|
+
- **`input(label, f_type="any")`**
|
|
29
|
+
|
|
30
|
+
- `label`: The caption text above the input field.
|
|
31
|
+
|
|
32
|
+
- `f_type`: Validation type. Options: `"any"`, `"float"` (numbers/decimals only), `"no digits"` (blocks numbers).
|
|
33
|
+
|
|
34
|
+
- **`button(text, func, type="primary")`**
|
|
35
|
+
|
|
36
|
+
- `text`: Label on the button.
|
|
37
|
+
|
|
38
|
+
- `func`: The function to execute when clicked.
|
|
39
|
+
|
|
40
|
+
- `type`: Styling choice. `"primary"` (Accent Blue) or `"secondary"` (Dark Gray).
|
|
41
|
+
|
|
42
|
+
- **`dropdown(label, options, callback)`**
|
|
43
|
+
|
|
44
|
+
- `label`: The caption above the selection menu.
|
|
45
|
+
|
|
46
|
+
- `options`: A list of strings, e.g., `["High", "Medium", "Low"]`.
|
|
47
|
+
|
|
48
|
+
- `callback`: Function that runs immediately when a value is selected.
|
|
49
|
+
|
|
50
|
+
- **`slider(label, start, end, step=1, callback=None)`**
|
|
51
|
+
|
|
52
|
+
- `label`: The name of the setting.
|
|
53
|
+
|
|
54
|
+
- `start` / `end`: Range values (min/max).
|
|
55
|
+
|
|
56
|
+
- `step`: The increment value (e.g., `1` or `0.5`).
|
|
57
|
+
|
|
58
|
+
- `callback`: Function that runs while the slider is moving.
|
|
59
|
+
|
|
60
|
+
- **`radio(label, options)`**
|
|
61
|
+
|
|
62
|
+
- `label`: Title of the radio group.
|
|
63
|
+
|
|
64
|
+
- `options`: List of strings for the selectable options.
|
|
65
|
+
|
|
66
|
+
- **`listbox(label, height=6)`**
|
|
67
|
+
|
|
68
|
+
- `label`: Title for the log/history window.
|
|
69
|
+
|
|
70
|
+
- `height`: How many lines high the box should be.
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
----------
|
|
74
|
+
|
|
75
|
+
### 3. Widget Methods (Interaction)
|
|
76
|
+
|
|
77
|
+
- **For Input:**
|
|
78
|
+
|
|
79
|
+
- `.get()`: Returns the current string typed in the field.
|
|
80
|
+
|
|
81
|
+
- `.clear()`: Erases all text from the field.
|
|
82
|
+
|
|
83
|
+
- **For Dropdown:**
|
|
84
|
+
|
|
85
|
+
- `.get()`: Returns the currently selected option string.
|
|
86
|
+
|
|
87
|
+
- **For Listbox:**
|
|
88
|
+
|
|
89
|
+
- `.add(text)`: Pushes a new line to the top of the box (adds `>` prefix automatically).
|
|
90
|
+
|
|
91
|
+
- `.clear()`: Deletes all entries in the log.
|
|
92
|
+
|
|
93
|
+
- **For Radio:**
|
|
94
|
+
|
|
95
|
+
- `.var.get()`: Retrieves the string value of the selected radio button.
|
|
96
|
+
|
|
97
|
+
- **For Slider:**
|
|
98
|
+
|
|
99
|
+
- `.info.cget("text")`: Useful for grabbing the formatted "Label: Value" string from the UI.
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
----------
|
|
103
|
+
|
|
104
|
+
### 4. Execution
|
|
105
|
+
|
|
106
|
+
- **`app.run()`**
|
|
107
|
+
|
|
108
|
+
- Starts the Tkinter main loop to display your window.
|
|
109
|
+
|
|
110
|
+
## Example:
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
from lb_auto_tk import LbAutoTk
|
|
114
|
+
|
|
115
|
+
# 1. Setup App
|
|
116
|
+
app = LbAutoTk("AI Image Studio")
|
|
117
|
+
app.header("Image Generator")
|
|
118
|
+
|
|
119
|
+
# 2. Text Inputs
|
|
120
|
+
prompt = app.input("Prompt", f_type="any")
|
|
121
|
+
negative = app.input("Negative Prompt", f_type="any")
|
|
122
|
+
|
|
123
|
+
# 3. Dropdown (Model Selection)
|
|
124
|
+
def on_model_change(val):
|
|
125
|
+
status.add(f"Switched to model: {val}")
|
|
126
|
+
model = app.dropdown("AI Model", ["Stable Diffusion v2.1", "Midjourney v6", "DALL-E 3"], on_model_change)
|
|
127
|
+
|
|
128
|
+
# 4. Radio Buttons (Aspect Ratio)
|
|
129
|
+
ratio = app.radio("Aspect Ratio", ["1:1", "16:9", "9:16"])
|
|
130
|
+
|
|
131
|
+
# 5. Slider (Sampling Steps)
|
|
132
|
+
steps = app.slider("Sampling Steps", 10, 100, 1)
|
|
133
|
+
|
|
134
|
+
# 6. Listbox (System Logs)
|
|
135
|
+
status = app.listbox("System Status", height=5)
|
|
136
|
+
|
|
137
|
+
# 7. Interaction Logic
|
|
138
|
+
def generate():
|
|
139
|
+
p = prompt.get()
|
|
140
|
+
m = model.get()
|
|
141
|
+
r = ratio.var.get()
|
|
142
|
+
s = steps.info.cget("text") # Get value from slider label
|
|
143
|
+
|
|
144
|
+
if not p:
|
|
145
|
+
status.add("ERROR: Prompt is empty!")
|
|
146
|
+
return
|
|
147
|
+
|
|
148
|
+
status.add(f"Generating '{p}'...")
|
|
149
|
+
status.add(f"Config: {m} | Ratio: {r} | {s}")
|
|
150
|
+
|
|
151
|
+
# 8. Buttons
|
|
152
|
+
app.button("GENERATE IMAGE", generate)
|
|
153
|
+
app.button("CLEAR LOGS", lambda: status.clear(), type="secondary")
|
|
154
|
+
|
|
155
|
+
app.run()
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# lb_auto_tk/button.py
|
|
2
|
+
import tkinter as tk
|
|
3
|
+
from .colors import COLORS
|
|
4
|
+
|
|
5
|
+
class Button:
|
|
6
|
+
def __init__(self, parent, text, func, type="primary"):
|
|
7
|
+
bg = COLORS["accent"] if type == "primary" else COLORS["card"]
|
|
8
|
+
self.btn = tk.Button(
|
|
9
|
+
parent, text=text.upper(), command=func,
|
|
10
|
+
bg=bg, fg=COLORS["text"], relief="flat",
|
|
11
|
+
font=("Segoe UI", 10, "bold"), activebackground="#3a6aaa",
|
|
12
|
+
cursor="hand2", bd=0
|
|
13
|
+
)
|
|
14
|
+
self.btn.pack(fill="x", pady=8, ipady=10)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# lb_auto_tk/colors.py
|
|
2
|
+
COLORS = {
|
|
3
|
+
"bg": "#121212", # Глубокий темный
|
|
4
|
+
"card": "#1e1e1e", # Чуть светлее для блоков
|
|
5
|
+
"text": "#ffffff", # Чистый белый
|
|
6
|
+
"dim": "#888888", # Серый для подписей
|
|
7
|
+
"accent": "#2a5a8a", # Синий акцент (Primary)
|
|
8
|
+
"danger": "#cf6679", # Красный для ошибок
|
|
9
|
+
"input_bg": "#252525" # Фон полей
|
|
10
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import tkinter as tk
|
|
2
|
+
from .colors import COLORS
|
|
3
|
+
from .button import Button
|
|
4
|
+
from .input import Input
|
|
5
|
+
from .slider import Slider
|
|
6
|
+
from .radio import Radio
|
|
7
|
+
# ДОБАВЬ ЭТИ ИМПОРТЫ:
|
|
8
|
+
from .dropdown import Dropdown
|
|
9
|
+
from .listbox import Listbox
|
|
10
|
+
|
|
11
|
+
class LbAutoTk:
|
|
12
|
+
def __init__(self, title="App"):
|
|
13
|
+
self.root = tk.Tk()
|
|
14
|
+
self.root.title(f"{title} - made with lb_auto_tk")
|
|
15
|
+
self.root.geometry("500x850")
|
|
16
|
+
self.root.configure(bg=COLORS["bg"])
|
|
17
|
+
|
|
18
|
+
self.main = tk.Frame(self.root, bg=COLORS["bg"], padx=30, pady=30)
|
|
19
|
+
self.main.pack(fill="both", expand=True)
|
|
20
|
+
|
|
21
|
+
def header(self, text):
|
|
22
|
+
tk.Label(self.main, text=text, bg=COLORS["bg"], fg=COLORS["text"],
|
|
23
|
+
font=("Segoe UI", 22, "bold")).pack(pady=(0, 20), anchor="w")
|
|
24
|
+
|
|
25
|
+
# ДОБАВЬ ЭТИ МЕТОДЫ:
|
|
26
|
+
def dropdown(self, label, options, callback):
|
|
27
|
+
return Dropdown(self.main, label, options, callback)
|
|
28
|
+
|
|
29
|
+
def listbox(self, label, height=6):
|
|
30
|
+
return Listbox(self.main, label, height)
|
|
31
|
+
|
|
32
|
+
# Остальные методы (input, button, slider, radio)...
|
|
33
|
+
def input(self, label, f_type="any"):
|
|
34
|
+
return Input(self.main, label, f_type)
|
|
35
|
+
|
|
36
|
+
def button(self, text, func, type="primary"):
|
|
37
|
+
return Button(self.main, text, func, type)
|
|
38
|
+
|
|
39
|
+
def slider(self, label, start, end, step=1, callback=None):
|
|
40
|
+
return Slider(self.main, label, start, end, step, callback)
|
|
41
|
+
|
|
42
|
+
def radio(self, label, options):
|
|
43
|
+
return Radio(self.main, label, options)
|
|
44
|
+
|
|
45
|
+
def run(self):
|
|
46
|
+
self.root.mainloop()
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import tkinter as tk
|
|
2
|
+
from tkinter import ttk
|
|
3
|
+
from .colors import COLORS
|
|
4
|
+
|
|
5
|
+
class Dropdown:
|
|
6
|
+
def __init__(self, parent, label, options, callback):
|
|
7
|
+
self.frame = tk.Frame(parent, bg=parent["bg"])
|
|
8
|
+
self.frame.pack(fill="x", pady=5)
|
|
9
|
+
|
|
10
|
+
if label:
|
|
11
|
+
tk.Label(self.frame, text=label.upper(), bg=parent["bg"],
|
|
12
|
+
fg=COLORS["dim"], font=("Segoe UI", 8, "bold")).pack(anchor="w")
|
|
13
|
+
|
|
14
|
+
self.var = tk.StringVar(value=options[0])
|
|
15
|
+
|
|
16
|
+
# Настройка стиля для выпадающего списка
|
|
17
|
+
self.cb = ttk.Combobox(self.frame, textvariable=self.var, values=options, state="readonly")
|
|
18
|
+
self.cb.bind("<<ComboboxSelected>>", lambda e: callback(self.var.get()))
|
|
19
|
+
self.cb.pack(fill="x", pady=(2, 10), ipady=3)
|
|
20
|
+
|
|
21
|
+
def get(self):
|
|
22
|
+
return self.var.get()
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# lb_auto_tk/input.py
|
|
2
|
+
import tkinter as tk
|
|
3
|
+
from .colors import COLORS
|
|
4
|
+
from .utils import validate_input
|
|
5
|
+
|
|
6
|
+
class Input:
|
|
7
|
+
def __init__(self, parent, label, f_type="any"):
|
|
8
|
+
self.frame = tk.Frame(parent, bg=parent["bg"])
|
|
9
|
+
self.frame.pack(fill="x", pady=5)
|
|
10
|
+
|
|
11
|
+
if label:
|
|
12
|
+
tk.Label(self.frame, text=label.upper(), bg=parent["bg"],
|
|
13
|
+
fg=COLORS["dim"], font=("Segoe UI", 8, "bold")).pack(anchor="w")
|
|
14
|
+
|
|
15
|
+
vcmd = (parent.register(validate_input), '%P', f_type)
|
|
16
|
+
|
|
17
|
+
# Основное поле ввода
|
|
18
|
+
self.entry = tk.Entry(
|
|
19
|
+
self.frame, bg=COLORS["input_bg"], fg=COLORS["text"],
|
|
20
|
+
insertbackground="white", relief="flat", borderwidth=0,
|
|
21
|
+
font=("Segoe UI", 11), validate="key", validatecommand=vcmd
|
|
22
|
+
)
|
|
23
|
+
# ipady создает внутреннее пространство сверху и снизу текста
|
|
24
|
+
self.entry.pack(fill="x", pady=(2, 10), ipady=8)
|
|
25
|
+
|
|
26
|
+
def get(self):
|
|
27
|
+
"""Возвращает текст из поля"""
|
|
28
|
+
return self.entry.get()
|
|
29
|
+
|
|
30
|
+
def clear(self):
|
|
31
|
+
"""Полностью очищает поле (то, чего не хватало)"""
|
|
32
|
+
self.entry.delete(0, tk.END)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import tkinter as tk
|
|
2
|
+
from .colors import COLORS
|
|
3
|
+
|
|
4
|
+
class Listbox:
|
|
5
|
+
def __init__(self, parent, label, height=6):
|
|
6
|
+
self.frame = tk.Frame(parent, bg=parent["bg"])
|
|
7
|
+
self.frame.pack(fill="x", pady=10)
|
|
8
|
+
|
|
9
|
+
if label:
|
|
10
|
+
tk.Label(self.frame, text=label.upper(), bg=parent["bg"],
|
|
11
|
+
fg=COLORS["dim"], font=("Segoe UI", 8, "bold")).pack(anchor="w")
|
|
12
|
+
|
|
13
|
+
# Контейнер для списка
|
|
14
|
+
self.lb_frame = tk.Frame(self.frame, bg=COLORS["input_bg"], padx=5, pady=5)
|
|
15
|
+
self.lb_frame.pack(fill="x", pady=5)
|
|
16
|
+
|
|
17
|
+
self.lb = tk.Listbox(
|
|
18
|
+
self.lb_frame, bg=COLORS["input_bg"], fg=COLORS["text"],
|
|
19
|
+
borderwidth=0, height=height, font=("Consolas", 10),
|
|
20
|
+
highlightthickness=0, selectbackground=COLORS["accent"]
|
|
21
|
+
)
|
|
22
|
+
self.lb.pack(side="left", fill="x", expand=True)
|
|
23
|
+
|
|
24
|
+
# Скроллбар (чтобы логи не улетали в пустоту)
|
|
25
|
+
sc = tk.Scrollbar(self.lb_frame, command=self.lb.yview, bg=COLORS["input_bg"])
|
|
26
|
+
self.lb.config(yscrollcommand=sc.set)
|
|
27
|
+
|
|
28
|
+
def add(self, text):
|
|
29
|
+
self.lb.insert(0, f"> {text}")
|
|
30
|
+
|
|
31
|
+
def clear(self):
|
|
32
|
+
self.lb.delete(0, tk.END)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# lb_auto_tk/radio.py
|
|
2
|
+
import tkinter as tk
|
|
3
|
+
from .colors import COLORS
|
|
4
|
+
|
|
5
|
+
class Radio:
|
|
6
|
+
def __init__(self, parent, label, options):
|
|
7
|
+
tk.Label(parent, text=label, bg=parent["bg"], fg=COLORS["dim"]).pack(anchor="w")
|
|
8
|
+
self.var = tk.StringVar(value=options[0])
|
|
9
|
+
f = tk.Frame(parent, bg=parent["bg"])
|
|
10
|
+
f.pack(fill="x", pady=5)
|
|
11
|
+
for o in options:
|
|
12
|
+
tk.Radiobutton(
|
|
13
|
+
f, text=o, variable=self.var, value=o,
|
|
14
|
+
bg=parent["bg"], fg=COLORS["text"],
|
|
15
|
+
selectcolor=COLORS["card"], activebackground=parent["bg"]
|
|
16
|
+
).pack(side="left", padx=10)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# lb_auto_tk/slider.py
|
|
2
|
+
import tkinter as tk
|
|
3
|
+
from tkinter import ttk
|
|
4
|
+
from .colors import COLORS
|
|
5
|
+
|
|
6
|
+
class Slider:
|
|
7
|
+
def __init__(self, parent, label, start, end, step, callback):
|
|
8
|
+
self.frame = tk.Frame(parent, bg=parent["bg"])
|
|
9
|
+
self.frame.pack(fill="x", pady=10)
|
|
10
|
+
|
|
11
|
+
self.label_text = label
|
|
12
|
+
self.step = step
|
|
13
|
+
self.callback = callback
|
|
14
|
+
|
|
15
|
+
self.info = tk.Label(self.frame, text=f"{label}: {start}", bg=parent["bg"], fg=COLORS["text"])
|
|
16
|
+
self.info.pack(anchor="w")
|
|
17
|
+
|
|
18
|
+
self.s = ttk.Scale(self.frame, from_=start, to=end, command=self._update)
|
|
19
|
+
self.s.pack(fill="x", pady=5)
|
|
20
|
+
|
|
21
|
+
def _update(self, val):
|
|
22
|
+
v = round(float(val) / self.step) * self.step
|
|
23
|
+
v = round(v, 2)
|
|
24
|
+
self.info.config(text=f"{self.label_text}: {v}")
|
|
25
|
+
if self.callback: self.callback(v)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# lb_auto_tk/utils.py
|
|
2
|
+
def validate_input(P, f_type):
|
|
3
|
+
if P == "": return True
|
|
4
|
+
if f_type == "digits": return P.isdigit()
|
|
5
|
+
if f_type == "no digits": return not any(c.isdigit() for c in P)
|
|
6
|
+
if f_type == "float":
|
|
7
|
+
if P in [".", ""]: return True
|
|
8
|
+
try:
|
|
9
|
+
float(P)
|
|
10
|
+
return True
|
|
11
|
+
except: return False
|
|
12
|
+
return True
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: lb-auto-tk
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: A not-so professional dark-mode GUI framework for quick application building
|
|
5
|
+
Author: abobus
|
|
6
|
+
Author-email: logic-break <abibasqabiba@email.com>
|
|
7
|
+
Requires-Python: >=3.6
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Dynamic: author
|
|
11
|
+
Dynamic: license-file
|
|
12
|
+
Dynamic: requires-python
|
|
13
|
+
|
|
14
|
+
# lb-auto-tk: lib for lazy
|
|
15
|
+
© Copyright logic-break 2026
|
|
16
|
+
https://logic-break.github.io
|
|
17
|
+
|
|
18
|
+
> lib made for lazy, by lazy
|
|
19
|
+
|
|
20
|
+
installation:
|
|
21
|
+
|
|
22
|
+
pip install lb_auto_tk
|
|
23
|
+
|
|
24
|
+
## Usage:
|
|
25
|
+
|
|
26
|
+
### 1. Main Application Class
|
|
27
|
+
|
|
28
|
+
- **`LbAutoTk(title="App")`**
|
|
29
|
+
|
|
30
|
+
- `title`: The text displayed on the window title bar.
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
----------
|
|
34
|
+
|
|
35
|
+
### 2. UI Components (Core Methods)
|
|
36
|
+
|
|
37
|
+
- **`header(text)`**
|
|
38
|
+
|
|
39
|
+
- `text`: Large, bold display text used as a section title inside the UI.
|
|
40
|
+
|
|
41
|
+
- **`input(label, f_type="any")`**
|
|
42
|
+
|
|
43
|
+
- `label`: The caption text above the input field.
|
|
44
|
+
|
|
45
|
+
- `f_type`: Validation type. Options: `"any"`, `"float"` (numbers/decimals only), `"no digits"` (blocks numbers).
|
|
46
|
+
|
|
47
|
+
- **`button(text, func, type="primary")`**
|
|
48
|
+
|
|
49
|
+
- `text`: Label on the button.
|
|
50
|
+
|
|
51
|
+
- `func`: The function to execute when clicked.
|
|
52
|
+
|
|
53
|
+
- `type`: Styling choice. `"primary"` (Accent Blue) or `"secondary"` (Dark Gray).
|
|
54
|
+
|
|
55
|
+
- **`dropdown(label, options, callback)`**
|
|
56
|
+
|
|
57
|
+
- `label`: The caption above the selection menu.
|
|
58
|
+
|
|
59
|
+
- `options`: A list of strings, e.g., `["High", "Medium", "Low"]`.
|
|
60
|
+
|
|
61
|
+
- `callback`: Function that runs immediately when a value is selected.
|
|
62
|
+
|
|
63
|
+
- **`slider(label, start, end, step=1, callback=None)`**
|
|
64
|
+
|
|
65
|
+
- `label`: The name of the setting.
|
|
66
|
+
|
|
67
|
+
- `start` / `end`: Range values (min/max).
|
|
68
|
+
|
|
69
|
+
- `step`: The increment value (e.g., `1` or `0.5`).
|
|
70
|
+
|
|
71
|
+
- `callback`: Function that runs while the slider is moving.
|
|
72
|
+
|
|
73
|
+
- **`radio(label, options)`**
|
|
74
|
+
|
|
75
|
+
- `label`: Title of the radio group.
|
|
76
|
+
|
|
77
|
+
- `options`: List of strings for the selectable options.
|
|
78
|
+
|
|
79
|
+
- **`listbox(label, height=6)`**
|
|
80
|
+
|
|
81
|
+
- `label`: Title for the log/history window.
|
|
82
|
+
|
|
83
|
+
- `height`: How many lines high the box should be.
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
----------
|
|
87
|
+
|
|
88
|
+
### 3. Widget Methods (Interaction)
|
|
89
|
+
|
|
90
|
+
- **For Input:**
|
|
91
|
+
|
|
92
|
+
- `.get()`: Returns the current string typed in the field.
|
|
93
|
+
|
|
94
|
+
- `.clear()`: Erases all text from the field.
|
|
95
|
+
|
|
96
|
+
- **For Dropdown:**
|
|
97
|
+
|
|
98
|
+
- `.get()`: Returns the currently selected option string.
|
|
99
|
+
|
|
100
|
+
- **For Listbox:**
|
|
101
|
+
|
|
102
|
+
- `.add(text)`: Pushes a new line to the top of the box (adds `>` prefix automatically).
|
|
103
|
+
|
|
104
|
+
- `.clear()`: Deletes all entries in the log.
|
|
105
|
+
|
|
106
|
+
- **For Radio:**
|
|
107
|
+
|
|
108
|
+
- `.var.get()`: Retrieves the string value of the selected radio button.
|
|
109
|
+
|
|
110
|
+
- **For Slider:**
|
|
111
|
+
|
|
112
|
+
- `.info.cget("text")`: Useful for grabbing the formatted "Label: Value" string from the UI.
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
----------
|
|
116
|
+
|
|
117
|
+
### 4. Execution
|
|
118
|
+
|
|
119
|
+
- **`app.run()`**
|
|
120
|
+
|
|
121
|
+
- Starts the Tkinter main loop to display your window.
|
|
122
|
+
|
|
123
|
+
## Example:
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
from lb_auto_tk import LbAutoTk
|
|
127
|
+
|
|
128
|
+
# 1. Setup App
|
|
129
|
+
app = LbAutoTk("AI Image Studio")
|
|
130
|
+
app.header("Image Generator")
|
|
131
|
+
|
|
132
|
+
# 2. Text Inputs
|
|
133
|
+
prompt = app.input("Prompt", f_type="any")
|
|
134
|
+
negative = app.input("Negative Prompt", f_type="any")
|
|
135
|
+
|
|
136
|
+
# 3. Dropdown (Model Selection)
|
|
137
|
+
def on_model_change(val):
|
|
138
|
+
status.add(f"Switched to model: {val}")
|
|
139
|
+
model = app.dropdown("AI Model", ["Stable Diffusion v2.1", "Midjourney v6", "DALL-E 3"], on_model_change)
|
|
140
|
+
|
|
141
|
+
# 4. Radio Buttons (Aspect Ratio)
|
|
142
|
+
ratio = app.radio("Aspect Ratio", ["1:1", "16:9", "9:16"])
|
|
143
|
+
|
|
144
|
+
# 5. Slider (Sampling Steps)
|
|
145
|
+
steps = app.slider("Sampling Steps", 10, 100, 1)
|
|
146
|
+
|
|
147
|
+
# 6. Listbox (System Logs)
|
|
148
|
+
status = app.listbox("System Status", height=5)
|
|
149
|
+
|
|
150
|
+
# 7. Interaction Logic
|
|
151
|
+
def generate():
|
|
152
|
+
p = prompt.get()
|
|
153
|
+
m = model.get()
|
|
154
|
+
r = ratio.var.get()
|
|
155
|
+
s = steps.info.cget("text") # Get value from slider label
|
|
156
|
+
|
|
157
|
+
if not p:
|
|
158
|
+
status.add("ERROR: Prompt is empty!")
|
|
159
|
+
return
|
|
160
|
+
|
|
161
|
+
status.add(f"Generating '{p}'...")
|
|
162
|
+
status.add(f"Config: {m} | Ratio: {r} | {s}")
|
|
163
|
+
|
|
164
|
+
# 8. Buttons
|
|
165
|
+
app.button("GENERATE IMAGE", generate)
|
|
166
|
+
app.button("CLEAR LOGS", lambda: status.clear(), type="secondary")
|
|
167
|
+
|
|
168
|
+
app.run()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
setup.py
|
|
5
|
+
lb_auto_tk/__init__.py
|
|
6
|
+
lb_auto_tk/button.py
|
|
7
|
+
lb_auto_tk/colors.py
|
|
8
|
+
lb_auto_tk/core.py
|
|
9
|
+
lb_auto_tk/dropdown.py
|
|
10
|
+
lb_auto_tk/input.py
|
|
11
|
+
lb_auto_tk/listbox.py
|
|
12
|
+
lb_auto_tk/radio.py
|
|
13
|
+
lb_auto_tk/slider.py
|
|
14
|
+
lb_auto_tk/utils.py
|
|
15
|
+
lb_auto_tk.egg-info/PKG-INFO
|
|
16
|
+
lb_auto_tk.egg-info/SOURCES.txt
|
|
17
|
+
lb_auto_tk.egg-info/dependency_links.txt
|
|
18
|
+
lb_auto_tk.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
lb_auto_tk
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build-meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "lb-auto-tk"
|
|
7
|
+
version = "0.0.2"
|
|
8
|
+
authors = [{name = "logic-break", email = "abibasqabiba@email.com"}]
|
|
9
|
+
description = "A not-so professional dark-mode GUI framework for quick application building"
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
requires-python = ">=3.7"
|
|
12
|
+
dependencies = []
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="lb_auto_tk",
|
|
5
|
+
version="1.0.0",
|
|
6
|
+
packages=find_packages(),
|
|
7
|
+
description="Ultimate auto-GUI framework for students",
|
|
8
|
+
author="abobus",
|
|
9
|
+
python_requires=">=3.6",
|
|
10
|
+
classifiers=[
|
|
11
|
+
"Programming Language :: Python :: 3",
|
|
12
|
+
"License :: OSI Approved :: MIT License",
|
|
13
|
+
"Operating System :: OS Independent",
|
|
14
|
+
],
|
|
15
|
+
)
|