FunctionGUI 0.6.4__py3-none-any.whl → 0.7.0__py3-none-any.whl
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.
- FunctionGUI/FunctionGUI.py +76 -7
- FunctionGUI/__init__.py +10 -1
- functiongui-0.7.0.dist-info/METADATA +132 -0
- functiongui-0.7.0.dist-info/RECORD +6 -0
- {FunctionGUI-0.6.4.dist-info → functiongui-0.7.0.dist-info}/WHEEL +1 -1
- FunctionGUI-0.6.4.dist-info/METADATA +0 -55
- FunctionGUI-0.6.4.dist-info/RECORD +0 -6
- {FunctionGUI-0.6.4.dist-info → functiongui-0.7.0.dist-info}/top_level.txt +0 -0
FunctionGUI/FunctionGUI.py
CHANGED
@@ -5,8 +5,12 @@ from ttkbootstrap import Style
|
|
5
5
|
from tkinter import font as tkfont
|
6
6
|
from PIL import Image, ImageTk
|
7
7
|
from tkinter import filedialog
|
8
|
-
|
9
|
-
|
8
|
+
import requests
|
9
|
+
from io import BytesIO
|
10
|
+
import csv
|
11
|
+
import sys
|
12
|
+
from tkinterdnd2 import TkinterDnD, DND_FILES
|
13
|
+
from tkinter import messagebox
|
10
14
|
def Window():
|
11
15
|
root = tk.Tk()
|
12
16
|
return root
|
@@ -14,6 +18,10 @@ def Window():
|
|
14
18
|
def Title(root, title = "New Window"):
|
15
19
|
a = root.title(title)
|
16
20
|
return a
|
21
|
+
def Dropdown(parent, textvariable, values):
|
22
|
+
dropdown = ttk.Combobox(parent, textvariable=textvariable, values=values)
|
23
|
+
return dropdown
|
24
|
+
|
17
25
|
|
18
26
|
def ScrollBar(root, widget, side="right", fill="y"):
|
19
27
|
a = widget
|
@@ -21,8 +29,24 @@ def ScrollBar(root, widget, side="right", fill="y"):
|
|
21
29
|
scrollbar.pack(side=side, fill=fill)
|
22
30
|
a.config(yscrollcommand=scrollbar.set)
|
23
31
|
|
24
|
-
|
25
|
-
|
32
|
+
|
33
|
+
|
34
|
+
def DragDropArea(parent, text="Drag and Drop here!", width=40, height=10, padx=20, pady=20):
|
35
|
+
label = tk.Label(parent, text=text, width=width, height=height, relief="solid")
|
36
|
+
label.pack(padx=padx, pady=pady)
|
37
|
+
|
38
|
+
def on_drop(event):
|
39
|
+
dropped_file = event.data
|
40
|
+
messagebox.showinfo("File Dropped", f"You dropped the file: {dropped_file}")
|
41
|
+
|
42
|
+
label.drop_target_register(DND_FILES)
|
43
|
+
label.dnd_bind('<<Drop>>', on_drop)
|
44
|
+
|
45
|
+
return label
|
46
|
+
|
47
|
+
|
48
|
+
def Label(parent, textvariabl, text=None, font="Helvetica", size=12, color="black", wraplenght=2, width=50):
|
49
|
+
label = ttk.Label(parent, text=text, font = (font, size), foreground = color, wraplength=wraplenght, textvariable=textvariabl, width=width)
|
26
50
|
return label
|
27
51
|
|
28
52
|
|
@@ -39,6 +63,16 @@ def StrVar(master, string):
|
|
39
63
|
def OpenFile(title):
|
40
64
|
file_path = filedialog.askopenfilename(title="Select a file")
|
41
65
|
return file_path
|
66
|
+
|
67
|
+
def SaveFile(title):
|
68
|
+
file_save = filedialog.asksaveasfilename(
|
69
|
+
title=title,
|
70
|
+
defaultextension=".txt",
|
71
|
+
filetypes=[("Text Files", "*.txt"), ("All Files", "*.*")]
|
72
|
+
)
|
73
|
+
return file_save
|
74
|
+
|
75
|
+
|
42
76
|
def ChexBox(parent, text = 'check me', variable=None, command = None):
|
43
77
|
checkbutton = ttk.Checkbutton(parent, text=text, variable=variable, command=command)
|
44
78
|
|
@@ -65,6 +99,40 @@ def Button(parent, text="Button", command=None, font="Helvetica", size=12, bg="b
|
|
65
99
|
def Entry(parent, width=20, font="Helvetica", size=12, bg="white", fg="black"):
|
66
100
|
entry = ttk.Entry(parent, width=width, font=(font, size), background=bg, foreground=fg)
|
67
101
|
return entry
|
102
|
+
def CVSREAD(filename):
|
103
|
+
with open(filename, newline='') as f:
|
104
|
+
reader = csv.reader(f)
|
105
|
+
return reader
|
106
|
+
|
107
|
+
def CVSWRITE(filename, data):
|
108
|
+
with open(filename, 'w', newline='') as f:
|
109
|
+
writer = csv.writer(f)
|
110
|
+
writer.writerows(data)
|
111
|
+
|
112
|
+
def Image(parent, path_or_url, width=None, height=None):
|
113
|
+
try:
|
114
|
+
# Load image from URL or file
|
115
|
+
if path_or_url.startswith('http'):
|
116
|
+
response = requests.get(path_or_url)
|
117
|
+
img_data = BytesIO(response.content)
|
118
|
+
else:
|
119
|
+
img_data = path_or_url
|
120
|
+
|
121
|
+
img = Image.open(img_data)
|
122
|
+
|
123
|
+
# Resize if needed
|
124
|
+
if width and height:
|
125
|
+
img = img.resize((width, height))
|
126
|
+
|
127
|
+
tk_img = ImageTk.PhotoImage(img)
|
128
|
+
|
129
|
+
label = tk.Label(parent, image=tk_img)
|
130
|
+
label.image = tk_img # Keep a reference to prevent garbage collection
|
131
|
+
label.pack()
|
132
|
+
return label
|
133
|
+
except Exception as e:
|
134
|
+
print("Error loading image:", e)
|
135
|
+
return None
|
68
136
|
|
69
137
|
def GetEntry(entry):
|
70
138
|
d = entry.get()
|
@@ -93,13 +161,14 @@ def BGImage(parent, bg_image_path = '', width=400 , height=300):
|
|
93
161
|
|
94
162
|
def Button(parent, text="Button", command=None, font="Helvetica", size=12, bg="black", fg="black", width=20, height=20, padx = 10, pady = 10):
|
95
163
|
button = tk.Button(parent, text=text, command=command, font=(font, size), bg=bg, fg=fg, width=width, height=height)
|
96
|
-
button.pack(padx=padx, pady=pady)
|
97
164
|
return button
|
98
165
|
|
99
166
|
def Entry(parent, width=20, font="Helvetica", size=12, bg="white", fg="black", padx = 10, pady = 10):
|
100
167
|
entry = ttk.Entry(parent, width=width, font=(font, size), background=bg, foreground=fg)
|
101
|
-
entry.pack(padx=padx, pady=pady)
|
102
168
|
return entry
|
103
|
-
|
169
|
+
def Close(window):
|
170
|
+
window.destroy()
|
171
|
+
def Exit():
|
172
|
+
sys.exit()
|
104
173
|
def Run(window):
|
105
174
|
window.mainloop()
|
FunctionGUI/__init__.py
CHANGED
@@ -0,0 +1,132 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: FunctionGUI
|
3
|
+
Version: 0.7.0
|
4
|
+
Summary: A simple Tkinter GUI library with basic widgets and functionality.
|
5
|
+
Home-page: https://github.com/aa425/FunctionGUI
|
6
|
+
Author: Aaroh Charne
|
7
|
+
Author-email: aaroh.charne@gmail.com
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
10
|
+
Classifier: Operating System :: OS Independent
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
12
|
+
Classifier: Intended Audience :: Developers
|
13
|
+
Classifier: Natural Language :: English
|
14
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
15
|
+
Requires-Python: >=3.6
|
16
|
+
Description-Content-Type: text/markdown
|
17
|
+
Requires-Dist: Pillow
|
18
|
+
Requires-Dist: ttkbootstrap
|
19
|
+
Requires-Dist: tkinterdnd2
|
20
|
+
Requires-Dist: requests
|
21
|
+
Dynamic: author
|
22
|
+
Dynamic: author-email
|
23
|
+
Dynamic: classifier
|
24
|
+
Dynamic: description
|
25
|
+
Dynamic: description-content-type
|
26
|
+
Dynamic: home-page
|
27
|
+
Dynamic: requires-dist
|
28
|
+
Dynamic: requires-python
|
29
|
+
Dynamic: summary
|
30
|
+
|
31
|
+
# FunctionGUI
|
32
|
+
|
33
|
+
FunctionGUI is a simple GUI library built using tkinter, designed to help you quickly create graphical user interfaces with ease.
|
34
|
+
|
35
|
+
## Installation
|
36
|
+
|
37
|
+
To install FunctionGUI, you can simply use pip:
|
38
|
+
|
39
|
+
```bash
|
40
|
+
pip install functiongui
|
41
|
+
```
|
42
|
+
|
43
|
+
|
44
|
+
# FunctionGUI
|
45
|
+
|
46
|
+
FunctionGUI is a simple GUI library built using tkinter, designed to help you quickly create graphical user interfaces with ease.
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
## Usage
|
51
|
+
```python
|
52
|
+
import functiongui as fg
|
53
|
+
|
54
|
+
# Create the main window
|
55
|
+
root = fg.Window()
|
56
|
+
|
57
|
+
# Set the title
|
58
|
+
fg.Title(root, "FunctionGUI Example")
|
59
|
+
|
60
|
+
# Set design/theme
|
61
|
+
theme = fg.Design("cosmo") # Uses ttkbootstrap
|
62
|
+
|
63
|
+
# Background Image
|
64
|
+
fg.BGImage(root, bg_image_path='your_image_path.jpg', width=500, height=400)
|
65
|
+
|
66
|
+
# BooleanVar for checkbox
|
67
|
+
check_var = fg.BulleanVar()
|
68
|
+
|
69
|
+
# Entry field
|
70
|
+
entry = fg.Entry(root, width=30, font="Helvetica", size=12, bg="white", fg="black", padx=5, pady=5)
|
71
|
+
fg.Place(entry)
|
72
|
+
|
73
|
+
# Button to print the entry value
|
74
|
+
def on_button_click():
|
75
|
+
value = fg.GetEntry(entry)
|
76
|
+
print("Entry value:", value)
|
77
|
+
|
78
|
+
button = fg.Button(root, text="Print Entry", command=on_button_click, font="Helvetica", size=12, bg="green", fg="white", width=20, height=2)
|
79
|
+
fg.Place(button, x=50, y=80)
|
80
|
+
|
81
|
+
# Label with StringVar
|
82
|
+
strvar = fg.StrVar(root, "Initial Text")
|
83
|
+
label = fg.Label(root, textvariabl=strvar, font="Arial", size=14, color="blue", wraplenght=200, width=30)
|
84
|
+
fg.Place(label)
|
85
|
+
|
86
|
+
# CheckBox
|
87
|
+
fg.ChexBox(root, text="Check me!", variable=check_var, command=lambda: print("Checkbox state:", check_var.get()))
|
88
|
+
|
89
|
+
# Dropdown
|
90
|
+
drop_var = fg.StrVar(root, "Option 1")
|
91
|
+
dropdown = fg.Dropdown(root, textvariable=drop_var, values=["Option 1", "Option 2", "Option 3"])
|
92
|
+
fg.Place(dropdown)
|
93
|
+
|
94
|
+
# Image display from file
|
95
|
+
fg.Image(root, "your_image_path.jpg", width=150, height=100)
|
96
|
+
|
97
|
+
# CSV functions (you can test separately)
|
98
|
+
fg.CVSWRITE("data.csv", [["Name", "Age"], ["Alice", 30]])
|
99
|
+
data = fg.CVSREAD("data.csv")
|
100
|
+
for row in data:
|
101
|
+
print(row)
|
102
|
+
|
103
|
+
# File dialogs
|
104
|
+
open_path = fg.OpenFile("Choose a file")
|
105
|
+
save_path = fg.SaveFile("Save your file")
|
106
|
+
|
107
|
+
# Drag and Drop area
|
108
|
+
drag_and_drop = fg.DragDropArea(root)
|
109
|
+
|
110
|
+
# Scrollable widget demo
|
111
|
+
text_widget = tk.Text(root, height=5, width=40)
|
112
|
+
fg.ScrollBar(root, text_widget)
|
113
|
+
text_widget.pack()
|
114
|
+
|
115
|
+
# Exit & Close examples (uncomment if needed)
|
116
|
+
fg.Exit()
|
117
|
+
|
118
|
+
# close a window
|
119
|
+
fg.Close(root)
|
120
|
+
|
121
|
+
# Start the GUI loop
|
122
|
+
fg.Run(root)
|
123
|
+
|
124
|
+
```
|
125
|
+
|
126
|
+
## Bugs
|
127
|
+
|
128
|
+
If you are finding bugs in the code, please report them to me @aaroh.charne@gmail.com.
|
129
|
+
Please include a snippet of your code as well the problem. Thank You
|
130
|
+
|
131
|
+
## Please check out my other Library Calclab @https://pypi.org/project/Calclab/
|
132
|
+
```
|
@@ -0,0 +1,6 @@
|
|
1
|
+
FunctionGUI/FunctionGUI.py,sha256=UH3eLqKB_lQSk6Z5msAXOlEm4A_mmqdEIozcWBiduPc,6029
|
2
|
+
FunctionGUI/__init__.py,sha256=RWAgaXxHwKtCitfDyBQ42qbR1rXz2Ntv45C9y9J-Pi8,384
|
3
|
+
functiongui-0.7.0.dist-info/METADATA,sha256=Nd2NErWwDMDIYau_G37ANamzNQPmGgdNaF9ywBFDLlU,3662
|
4
|
+
functiongui-0.7.0.dist-info/WHEEL,sha256=lTU6B6eIfYoiQJTZNc-fyaR6BpL6ehTzU3xGYxn2n8k,91
|
5
|
+
functiongui-0.7.0.dist-info/top_level.txt,sha256=_gisKDTO1FqIkJYqH6X1ZrcA0ZvQdKnA_JhABqCSUFo,12
|
6
|
+
functiongui-0.7.0.dist-info/RECORD,,
|
@@ -1,55 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.1
|
2
|
-
Name: FunctionGUI
|
3
|
-
Version: 0.6.4
|
4
|
-
Summary: A simple Tkinter GUI library with basic widgets and functionality.
|
5
|
-
Home-page: https://github.com/aa425/FunctionGUI
|
6
|
-
Author: Aaroh Charne
|
7
|
-
Author-email: aaroh.charne@gmail.com
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
9
|
-
Classifier: License :: OSI Approved :: MIT License
|
10
|
-
Classifier: Operating System :: OS Independent
|
11
|
-
Classifier: Development Status :: 3 - Alpha
|
12
|
-
Classifier: Intended Audience :: Developers
|
13
|
-
Classifier: Natural Language :: English
|
14
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
15
|
-
Requires-Python: >=3.6
|
16
|
-
Description-Content-Type: text/markdown
|
17
|
-
Requires-Dist: Pillow
|
18
|
-
Requires-Dist: ttkbootstrap
|
19
|
-
|
20
|
-
## Sentience
|
21
|
-
|
22
|
-
Sentience is a basic AI library made to simplify the usage of the genai library by providing basic functions for chat at a higher level.
|
23
|
-
|
24
|
-
|
25
|
-
## Installation
|
26
|
-
|
27
|
-
To install Sentience, you can simply use:
|
28
|
-
|
29
|
-
```bash
|
30
|
-
pip install Sentience
|
31
|
-
```
|
32
|
-
|
33
|
-
## Usage
|
34
|
-
```python
|
35
|
-
#Set your api (does not return in a variable)
|
36
|
-
API(your_api_key)
|
37
|
-
#Make the model, settings can be altered (returns the model in a variable), code example provides default settings
|
38
|
-
model = Model(model = "gemini-1.5-pro", temperature = 1, top_p = 0.95, top_k = 40, max_output_tokens = 8192)
|
39
|
-
|
40
|
-
#Uses model created above to make a chat (returns chat in a variable)
|
41
|
-
chat = Chat(model)
|
42
|
-
|
43
|
-
#Sends a message to your chat, replace chat with the varible you have named your chat
|
44
|
-
response = Send(chat, "Hello, how are you?")
|
45
|
-
|
46
|
-
print(response)
|
47
|
-
```
|
48
|
-
|
49
|
-
# Bugs
|
50
|
-
|
51
|
-
If you are finding bugs in the code, please report them to me @aaroh.charne@gmail.com.
|
52
|
-
Please include a snippet of your code as well the problem. Thank You
|
53
|
-
|
54
|
-
|
55
|
-
```
|
@@ -1,6 +0,0 @@
|
|
1
|
-
FunctionGUI/FunctionGUI.py,sha256=zF2lnsli_w9vwUJ7331QFDJdyuCeHvf41Xp--GyvTD4,4033
|
2
|
-
FunctionGUI/__init__.py,sha256=QVxdhpXu8KTDl7ylSFkn7HucZiS2HHLoJSW4nPVPCtY,256
|
3
|
-
FunctionGUI-0.6.4.dist-info/METADATA,sha256=w0_lVHlQBncp5P7S5Ay9vDFkq0AdXgCNPt0nigpNmyM,1724
|
4
|
-
FunctionGUI-0.6.4.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
5
|
-
FunctionGUI-0.6.4.dist-info/top_level.txt,sha256=_gisKDTO1FqIkJYqH6X1ZrcA0ZvQdKnA_JhABqCSUFo,12
|
6
|
-
FunctionGUI-0.6.4.dist-info/RECORD,,
|
File without changes
|